Class: Puppet::FileBucket::File::StringContents Private
- Defined in:
- lib/puppet/file_bucket/file.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
- #checksum_data(base_method) ⇒ Object private
-
#initialize(content) ⇒ StringContents
constructor
private
A new instance of StringContents.
- #size ⇒ Object private
- #stream(&block) ⇒ Object private
- #to_binary ⇒ Object private
Constructor Details
#initialize(content) ⇒ StringContents
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 StringContents.
79 80 81 |
# File 'lib/puppet/file_bucket/file.rb', line 79 def initialize(content) @contents = content; end |
Instance Method Details
#checksum_data(base_method) ⇒ 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.
96 97 98 99 |
# File 'lib/puppet/file_bucket/file.rb', line 96 def checksum_data(base_method) Puppet.info(_("Computing checksum on string")) Puppet::Util::Checksums.method(base_method).call(@contents) end |
#size ⇒ 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.
92 93 94 |
# File 'lib/puppet/file_bucket/file.rb', line 92 def size @contents.size end |
#stream(&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.
83 84 85 86 87 88 89 90 |
# File 'lib/puppet/file_bucket/file.rb', line 83 def stream(&block) s = StringIO.new(@contents) begin block.call(s) ensure s.close end end |
#to_binary ⇒ 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.
101 102 103 104 105 |
# File 'lib/puppet/file_bucket/file.rb', line 101 def to_binary # This is not so horrible as for FileContent, but still possible to mutate the content that the # checksum is based on... so semi horrible... return @contents; end |