Class: Puppet::FileBucket::File::StringContents
- Defined in:
- lib/puppet/file_bucket/file.rb
Instance Method Summary collapse
- #checksum_data(base_method) ⇒ Object
-
#initialize(content) ⇒ StringContents
constructor
A new instance of StringContents.
- #size ⇒ Object
- #stream(&block) ⇒ Object
- #to_binary ⇒ Object
Constructor Details
#initialize(content) ⇒ StringContents
Returns a new instance of StringContents.
80 81 82 |
# File 'lib/puppet/file_bucket/file.rb', line 80 def initialize(content) @contents = content; end |
Instance Method Details
#checksum_data(base_method) ⇒ Object
97 98 99 100 |
# File 'lib/puppet/file_bucket/file.rb', line 97 def checksum_data(base_method) Puppet.info(_("Computing checksum on string")) Puppet::Util::Checksums.method(base_method).call(@contents) end |
#size ⇒ Object
93 94 95 |
# File 'lib/puppet/file_bucket/file.rb', line 93 def size @contents.size end |
#stream(&block) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/puppet/file_bucket/file.rb', line 84 def stream(&block) s = StringIO.new(@contents) begin block.call(s) ensure s.close end end |
#to_binary ⇒ Object
102 103 104 105 106 |
# File 'lib/puppet/file_bucket/file.rb', line 102 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 |