PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
| Dir : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/file_system/ |
| Server: Linux server1.ngambekcore.com 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 04:00:07 EDT 2025 x86_64 IP: 159.198.77.92 |
| Dir : //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/file_system/memory_impl.rb |
class Puppet::FileSystem::MemoryImpl
def initialize(*files)
@files = files + all_children_of(files)
end
def expand_path(path, dir_string = nil)
File.expand_path(path, dir_string)
end
def exist?(path)
path.exist?
end
def directory?(path)
path.directory?
end
def file?(path)
path.file?
end
def executable?(path)
path.executable?
end
def symlink?(path)
path.symlink?
end
def readlink(path)
path = path.path
link = find(path)
return Puppet::FileSystem::MemoryFile.a_missing_file(path) unless link
source = link.source_path
return Puppet::FileSystem::MemoryFile.a_missing_file(link) unless source
find(source) || Puppet::FileSystem::MemoryFile.a_missing_file(source)
end
def children(path)
path.children
end
def each_line(path, &block)
path.each_line(&block)
end
def pathname(path)
find(path) || Puppet::FileSystem::MemoryFile.a_missing_file(path)
end
def basename(path)
path.duplicate_as(File.basename(path_string(path)))
end
def path_string(object)
object.path
end
def read(path, opts = {})
handle = assert_path(path).handle
handle.read
end
def read_preserve_line_endings(path)
read(path)
end
def open(path, *args, &block)
handle = assert_path(path).handle
if block_given?
yield handle
else
return handle
end
end
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}") % { path: path.inspect }
end
end
private
def find(path)
@files.find { |file| file.path == path }
end
def all_children_of(files)
children = files.collect(&:children).flatten
if children.empty?
[]
else
children + all_children_of(children)
end
end
end