assert_path(path)
click to toggle source
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
def basename(path)
path.duplicate_as(File.basename(path_string(path)))
end
children(path)
click to toggle source
def children(path)
path.children
end
directory?(path)
click to toggle source
def directory?(path)
path.directory?
end
each_line(path, &block)
click to toggle source
def each_line(path, &block)
path.each_line(&block)
end
executable?(path)
click to toggle source
def executable?(path)
path.executable?
end
exist?(path)
click to toggle source
def exist?(path)
path.exist?
end
file?(path)
click to toggle source
def file?(path)
path.file?
end
open(path, *args) { |handle| ... }
click to toggle source
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
def path_string(object)
object.path
end
pathname(path)
click to toggle source
def pathname(path)
find(path) || Puppet::FileSystem::MemoryFile.a_missing_file(path)
end
read(path)
click to toggle source
def read(path)
handle = assert_path(path).handle
handle.read
end
read_preserve_line_endings(path)
click to toggle source
def read_preserve_line_endings(path)
read(path)
end