class Puppet::FileSystem::MemoryImpl

Public Instance Methods

assert_path(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 60
def assert_path(path)
  if path.is_a?(Puppet::FileSystem::MemoryFile)
    path
  else
    find(path) or raise ArgumentError, "Unable to find registered object for #{path.inspect}"
  end
end
basename(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 34
def basename(path)
  path.duplicate_as(File.basename(path_string(path)))
end
children(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 22
def children(path)
  path.children
end
directory?(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 10
def directory?(path)
  path.directory?
end
each_line(path, &block) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 26
def each_line(path, &block)
  path.each_line(&block)
end
executable?(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 18
def executable?(path)
  path.executable?
end
exist?(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 6
def exist?(path)
  path.exist?
end
file?(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 14
def file?(path)
  path.file?
end
open(path, *args) { |handle| ... } click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 51
def open(path, *args, &block)
  handle = assert_path(path).handle
  if block_given?
    yield handle
  else
    return handle
  end
end
path_string(object) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 38
def path_string(object)
  object.path
end
pathname(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 30
def pathname(path)
  find(path) || Puppet::FileSystem::MemoryFile.a_missing_file(path)
end
read(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 42
def read(path)
  handle = assert_path(path).handle
  handle.read
end
read_preserve_line_endings(path) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 47
def read_preserve_line_endings(path)
  read(path)
end

Public Class Methods

new(*files) click to toggle source
# File lib/puppet/file_system/memory_impl.rb, line 2
def initialize(*files)
  @files = files + all_children_of(files)
end