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 25 def self.a_directory(path, children = []) 26 new(path, 27 :exist? => true, 28 :executable? => true, 29 :directory? => true, 30 :children => children) 31 end
a_missing_directory(path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 10 def self.a_missing_directory(path) 11 new(path, 12 :exist? => false, 13 :executable? => false, 14 :directory? => true) 15 end
a_missing_file(path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 6 def self.a_missing_file(path) 7 new(path, :exist? => false, :executable? => false) 8 end
a_regular_file_containing(path, content)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 17 def self.a_regular_file_containing(path, content) 18 new(path, :exist? => true, :executable? => false, :content => content) 19 end
a_symlink(target_path, source_path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 33 def self.a_symlink(target_path, source_path) 34 new(target_path, :exist? => true, :symlink? => true, :source_path => source_path) 35 end
an_executable(path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 21 def self.an_executable(path) 22 new(path, :exist? => true, :executable? => true) 23 end
new(path, properties)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 37 def initialize(path, properties) 38 @path = path 39 @properties = properties 40 @children = (properties[:children] || []).collect do |child| 41 child.duplicate_as(File.join(@path, child.path)) 42 end 43 end
Public Instance Methods
absolute?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 64 def absolute? 65 Pathname.new(path).absolute? 66 end
directory?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 45 def directory?; @properties[:directory?]; end
duplicate_as(other_path)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 60 def duplicate_as(other_path) 61 self.class.new(other_path, @properties) 62 end
each_line(&block)
click to toggle source
# File lib/puppet/file_system/memory_file.rb 51 def each_line(&block) 52 handle.each_line(&block) 53 end
executable?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 47 def executable?; @properties[:executable?]; end
exist?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 46 def exist?; @properties[:exist?]; end
handle()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 55 def handle 56 raise Errno::ENOENT unless exist? 57 StringIO.new(@properties[:content] || '') 58 end
inspect()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 76 def inspect 77 "<Puppet::FileSystem::MemoryFile:#{self}>" 78 end
source_path()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 49 def source_path; @properties[:source_path]; end
symlink?()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 48 def symlink?; @properties[:symlink?]; end
to_path()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 68 def to_path 69 path 70 end
to_s()
click to toggle source
# File lib/puppet/file_system/memory_file.rb 72 def to_s 73 to_path 74 end