Class: Puppet::FileServing::Content Private
- Extended by:
- Indirector
- Defined in:
- lib/puppet/file_serving/content.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.
A class that handles retrieving file contents. It only reads the file when its content is specifically asked for.
Constant Summary
Constants included from Indirector
Instance Attribute Summary collapse
-
#content ⇒ Object
private
Read the content of our file in.
Attributes inherited from Base
#links, #path, #relative_path, #source
Class Method Summary collapse
- .from_binary(content) ⇒ Object private
- .supported_formats ⇒ Object private
Instance Method Summary collapse
-
#collect(source_permissions = nil) ⇒ Object
private
This is no longer used, but is still called by the file server implementations when interacting with their model abstraction.
- #to_binary ⇒ Object private
Methods included from Indirector
Methods inherited from Base
absolute?, #exist?, #full_path, #initialize, #stat, #to_data_hash
Constructor Details
This class inherits a constructor from Puppet::FileServing::Base
Instance Attribute Details
#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.
Read the content of our file in.
31 32 33 34 35 36 37 38 39 |
# File 'lib/puppet/file_serving/content.rb', line 31 def content unless @content # This stat can raise an exception, too. raise(ArgumentError, _("Cannot read the contents of links unless following links")) if stat.ftype == "symlink" @content = Puppet::FileSystem.binread(full_path) end @content end |
Class Method Details
.from_binary(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.
19 20 21 22 23 |
# File 'lib/puppet/file_serving/content.rb', line 19 def self.from_binary(content) instance = new("/this/is/a/fake/path") instance.content = content instance end |
.supported_formats ⇒ 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.
15 16 17 |
# File 'lib/puppet/file_serving/content.rb', line 15 def self.supported_formats [:binary] end |
Instance Method Details
#collect(source_permissions = 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.
This is no longer used, but is still called by the file server implementations when interacting with their model abstraction.
27 28 |
# File 'lib/puppet/file_serving/content.rb', line 27 def collect( = nil) end |