Class: Puppet::FileSystem::MemoryFile Private
- Defined in:
- lib/puppet/file_system/memory_file.rb
Overview
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.
An in-memory file abstraction. Commonly used with Puppet::FileSystem::File#overlay
Instance Attribute Summary collapse
- #path ⇒ Object readonly private
Class Method Summary collapse
- .a_missing_file(path) ⇒ Object private
- .a_regular_file_containing(path, content) ⇒ Object private
- .an_executable(path) ⇒ Object private
Instance Method Summary collapse
- #each_line(&block) ⇒ Object private
- #executable? ⇒ Boolean private
- #exist? ⇒ Boolean private
-
#initialize(path, options) ⇒ MemoryFile
constructor
private
A new instance of MemoryFile.
Constructor Details
#initialize(path, options) ⇒ MemoryFile
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 MemoryFile.
18 19 20 21 22 23 |
# File 'lib/puppet/file_system/memory_file.rb', line 18 def initialize(path, ) @path = Pathname.new(path) @exist = [:exist?] @executable = [:executable?] @content = [:content] end |
Instance Attribute Details
#path ⇒ Object (readonly)
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.
4 5 6 |
# File 'lib/puppet/file_system/memory_file.rb', line 4 def path @path end |
Class Method Details
.a_missing_file(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.
6 7 8 |
# File 'lib/puppet/file_system/memory_file.rb', line 6 def self.a_missing_file(path) new(path, :exist? => false, :executable? => false) end |
.a_regular_file_containing(path, content) ⇒ 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.
10 11 12 |
# File 'lib/puppet/file_system/memory_file.rb', line 10 def self.a_regular_file_containing(path, content) new(path, :exist? => true, :executable? => false, :content => content) end |
.an_executable(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.
14 15 16 |
# File 'lib/puppet/file_system/memory_file.rb', line 14 def self.an_executable(path) new(path, :exist? => true, :executable? => true) end |
Instance Method Details
#each_line(&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.
28 29 30 |
# File 'lib/puppet/file_system/memory_file.rb', line 28 def each_line(&block) StringIO.new(@content).each_line(&block) end |
#executable? ⇒ 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.
26 |
# File 'lib/puppet/file_system/memory_file.rb', line 26 def executable?; @executable; end |
#exist? ⇒ 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.
25 |
# File 'lib/puppet/file_system/memory_file.rb', line 25 def exist?; @exist; end |