An in-memory file abstraction. Commonly used with Puppet::FileSystem::File#overlay @api private
# File lib/puppet/file_system/memory_file.rb, line 51 def absolute? Pathname.new(path).absolute? end
# File lib/puppet/file_system/memory_file.rb, line 34 def directory?; @properties[:directory?]; end
# File lib/puppet/file_system/memory_file.rb, line 47 def duplicate_as(other_path) self.class.new(other_path, @properties) end
# File lib/puppet/file_system/memory_file.rb, line 38 def each_line(&block) handle.each_line(&block) end
# File lib/puppet/file_system/memory_file.rb, line 36 def executable?; @properties[:executable?]; end
# File lib/puppet/file_system/memory_file.rb, line 35 def exist?; @properties[:exist?]; end
# File lib/puppet/file_system/memory_file.rb, line 42 def handle raise Errno::ENOENT unless exist? StringIO.new(@properties[:content] || '') end
# File lib/puppet/file_system/memory_file.rb, line 68 def inspect "<Puppet::FileSystem::MemoryFile:#{to_s}>" end
# File lib/puppet/file_system/memory_file.rb, line 55 def to_path path end
# File lib/puppet/file_system/memory_file.rb, line 59 def to_s to_path end
Used by Ruby 1.8.7 file system abstractions when operating on Pathname like things.
# File lib/puppet/file_system/memory_file.rb, line 64 def to_str to_path end
# File lib/puppet/file_system/memory_file.rb, line 18 def self.a_directory(path, children = []) new(path, :exist? => true, :excutable? => true, :directory? => true, :children => children) end
# File lib/puppet/file_system/memory_file.rb, line 6 def self.a_missing_file(path) new(path, :exist? => false, :executable? => false) end
# File lib/puppet/file_system/memory_file.rb, line 10 def self.a_regular_file_containing(path, content) new(path, :exist? => true, :executable? => false, :content => content) end
# File lib/puppet/file_system/memory_file.rb, line 14 def self.an_executable(path) new(path, :exist? => true, :executable? => true) end
# File lib/puppet/file_system/memory_file.rb, line 26 def initialize(path, properties) @path = path @properties = properties @children = (properties[:children] || []).collect do |child| child.duplicate_as(File.join(@path, child.path)) end end