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.
108 109 110 |
# File 'lib/puppet/file_bucket/file.rb', line 108 def initialize(path) @path = path end |
Instance Method Details
#checksum_data(base_method) ⇒ Object
120 121 122 123 |
# File 'lib/puppet/file_bucket/file.rb', line 120 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
116 117 118 |
# File 'lib/puppet/file_bucket/file.rb', line 116 def size Puppet::FileSystem.size(@path) end |
#stream(&block) ⇒ Object
112 113 114 |
# File 'lib/puppet/file_bucket/file.rb', line 112 def stream(&block) Puppet::FileSystem.open(@path, nil, 'rb', &block) end |
#to_binary ⇒ Object
125 126 127 |
# File 'lib/puppet/file_bucket/file.rb', line 125 def to_binary Puppet::FileSystem::binread(@path) end |