class Puppet::FileSystem::MemoryFile
An in-memory file abstraction. Commonly used with Puppet::FileSystem::File#overlay @api private
Attributes
children[R]
path[R]
Public Class Methods
a_directory(path, children = [])
click to toggle source
# File lib/puppet/file_system/memory_file.rb 26 def self.a_directory(path, children = []) 27 new(path, 28 :exist? => true, 29 :executable? => true, 30 :directory? => true, 31 :children => children) 32 end
a_missing_directory(path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 11 def self.a_missing_directory(path) 12 new(path, 13 :exist? => false, 14 :executable? => false, 15 :directory? => true) 16 end
a_missing_file(path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 7 def self.a_missing_file(path) 8 new(path, :exist? => false, :executable? => false) 9 end
a_regular_file_containing(path, content)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 18 def self.a_regular_file_containing(path, content) 19 new(path, :exist? => true, :executable? => false, :content => content) 20 end
a_symlink(target_path, source_path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 34 def self.a_symlink(target_path, source_path) 35 new(target_path, :exist? => true, :symlink? => true, :source_path => source_path) 36 end
an_executable(path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 22 def self.an_executable(path) 23 new(path, :exist? => true, :executable? => true) 24 end
new(path, properties)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 38 def initialize(path, properties) 39 @path = path 40 @properties = properties 41 @children = (properties[:children] || []).collect do |child| 42 child.duplicate_as(File.join(@path, child.path)) 43 end 44 end
Public Instance Methods
absolute?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 65 def absolute? 66 Pathname.new(path).absolute? 67 end
directory?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 46 def directory?; @properties[:directory?]; end
duplicate_as(other_path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 61 def duplicate_as(other_path) 62 self.class.new(other_path, @properties) 63 end
each_line(&block)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 52 def each_line(&block) 53 handle.each_line(&block) 54 end
executable?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 48 def executable?; @properties[:executable?]; end
exist?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 47 def exist?; @properties[:exist?]; end
handle()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 56 def handle 57 raise Errno::ENOENT unless exist? 58 StringIO.new(@properties[:content] || '') 59 end
inspect()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 77 def inspect 78 "<Puppet::FileSystem::MemoryFile:#{self}>" 79 end
source_path()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 50 def source_path; @properties[:source_path]; end
symlink?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 49 def symlink?; @properties[:symlink?]; end
to_path()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 69 def to_path 70 path 71 end
to_s()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 73 def to_s 74 to_path 75 end