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_binary ⇒ Object
Constructor Details
#initialize(path) ⇒ FileContents
Returns a new instance of FileContents.
110 111 112 |
# File 'lib/puppet/file_bucket/file.rb', line 110 def initialize(path) @path = path end |
Instance Method Details
#checksum_data(base_method) ⇒ Object
122 123 124 125 |
# File 'lib/puppet/file_bucket/file.rb', line 122 def checksum_data(base_method) Puppet.info(_("Computing checksum on file %{path}") % { path: @path }) Puppet::Util::Checksums.method(:"#{base_method}_file").call(@path) end |
#size ⇒ Object
118 119 120 |
# File 'lib/puppet/file_bucket/file.rb', line 118 def size Puppet::FileSystem.size(@path) end |
#stream(&block) ⇒ Object
114 115 116 |
# File 'lib/puppet/file_bucket/file.rb', line 114 def stream(&block) Puppet::FileSystem.open(@path, nil, 'rb', &block) end |
#to_binary ⇒ Object
127 128 129 |
# File 'lib/puppet/file_bucket/file.rb', line 127 def to_binary Puppet::FileSystem::binread(@path) end |