Class: Puppet::FileSystem::MemoryImpl Private
- Defined in:
- lib/puppet/file_system/memory_impl.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #assert_path(path) ⇒ Object private
- #basename(path) ⇒ Object private
- #children(path) ⇒ Object private
- #directory?(path) ⇒ Boolean private
- #each_line(path, &block) ⇒ Object private
- #executable?(path) ⇒ Boolean private
- #exist?(path) ⇒ Boolean private
- #expand_path(path, dir_string = nil) ⇒ Object private
- #file?(path) ⇒ Boolean private
-
#initialize(*files) ⇒ MemoryImpl
constructor
private
A new instance of MemoryImpl.
- #open(path, *args, &block) ⇒ Object private
- #path_string(object) ⇒ Object private
- #pathname(path) ⇒ Object private
- #read(path, opts = {}) ⇒ Object private
- #read_preserve_line_endings(path) ⇒ Object private
- #readlink(path) ⇒ Object private
- #symlink?(path) ⇒ Boolean private
Constructor Details
#initialize(*files) ⇒ MemoryImpl
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MemoryImpl.
4 5 6 |
# File 'lib/puppet/file_system/memory_impl.rb', line 4 def initialize(*files) @files = files + all_children_of(files) end |
Instance Method Details
#assert_path(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 84 85 86 87 |
# File 'lib/puppet/file_system/memory_impl.rb', line 81 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 |
#basename(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
55 56 57 |
# File 'lib/puppet/file_system/memory_impl.rb', line 55 def basename(path) path.duplicate_as(File.basename(path_string(path))) end |
#children(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# File 'lib/puppet/file_system/memory_impl.rb', line 43 def children(path) path.children end |
#directory?(path) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/puppet/file_system/memory_impl.rb', line 16 def directory?(path) path.directory? end |
#each_line(path, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/puppet/file_system/memory_impl.rb', line 47 def each_line(path, &block) path.each_line(&block) end |
#executable?(path) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/puppet/file_system/memory_impl.rb', line 24 def executable?(path) path.executable? end |
#exist?(path) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/puppet/file_system/memory_impl.rb', line 12 def exist?(path) path.exist? end |
#expand_path(path, dir_string = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/puppet/file_system/memory_impl.rb', line 8 def (path, dir_string = nil) File.(path, dir_string) end |
#file?(path) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/puppet/file_system/memory_impl.rb', line 20 def file?(path) path.file? end |
#open(path, *args, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
72 73 74 75 76 77 78 79 |
# File 'lib/puppet/file_system/memory_impl.rb', line 72 def open(path, *args, &block) handle = assert_path(path).handle if block_given? yield handle else handle end end |
#path_string(object) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 60 61 |
# File 'lib/puppet/file_system/memory_impl.rb', line 59 def path_string(object) object.path end |
#pathname(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 |
# File 'lib/puppet/file_system/memory_impl.rb', line 51 def pathname(path) find(path) || Puppet::FileSystem::MemoryFile.a_missing_file(path) end |
#read(path, opts = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 66 |
# File 'lib/puppet/file_system/memory_impl.rb', line 63 def read(path, opts = {}) handle = assert_path(path).handle handle.read end |
#read_preserve_line_endings(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
68 69 70 |
# File 'lib/puppet/file_system/memory_impl.rb', line 68 def read_preserve_line_endings(path) read(path) end |
#readlink(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/puppet/file_system/memory_impl.rb', line 32 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 |
#symlink?(path) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/puppet/file_system/memory_impl.rb', line 28 def symlink?(path) path.symlink? end |