Class: Puppet::FileBucket::File::FileContents
- Defined in:
- lib/puppet/file_bucket/file.rb
Instance Method Summary collapse
- #checksum_data(base_method) ⇒ Object
-
#initialize(path) ⇒ FileContents
constructor
A new instance of FileContents.
- #size ⇒ Object
- #stream(&block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(path) ⇒ FileContents
Returns a new instance of FileContents.
136 137 138 |
# File 'lib/puppet/file_bucket/file.rb', line 136 def initialize(path) @path = path end |
Instance Method Details
#checksum_data(base_method) ⇒ Object
148 149 150 151 |
# File 'lib/puppet/file_bucket/file.rb', line 148 def checksum_data(base_method) Puppet.info("Computing checksum on file #{@path}") Puppet::Util::Checksums.method(:"#{base_method}_file").call(@path) end |
#size ⇒ Object
144 145 146 |
# File 'lib/puppet/file_bucket/file.rb', line 144 def size Puppet::FileSystem.size(@path) end |
#stream(&block) ⇒ Object
140 141 142 |
# File 'lib/puppet/file_bucket/file.rb', line 140 def stream(&block) Puppet::FileSystem.open(@path, nil, 'rb', &block) end |
#to_s ⇒ Object
153 154 155 |
# File 'lib/puppet/file_bucket/file.rb', line 153 def to_s Puppet::FileSystem::binread(@path) end |