Class: Chef::Digester
- Inherits:
-
Object
- Object
- Chef::Digester
- Includes:
- Singleton
- Defined in:
- lib/chef/digester.rb
Class Method Summary collapse
Instance Method Summary collapse
- #checksum_for_file(file) ⇒ Object
- #generate_checksum(file) ⇒ Object
- #generate_md5_checksum(io) ⇒ Object
- #generate_md5_checksum_for_file(file) ⇒ Object
- #validate_checksum(*args) ⇒ Object
Class Method Details
.checksum_for_file(*args) ⇒ Object
29 30 31 |
# File 'lib/chef/digester.rb', line 29 def self.checksum_for_file(*args) instance.checksum_for_file(*args) end |
.generate_md5_checksum_for_file(*args) ⇒ Object
49 50 51 |
# File 'lib/chef/digester.rb', line 49 def self.generate_md5_checksum_for_file(*args) instance.generate_md5_checksum_for_file(*args) end |
Instance Method Details
#checksum_for_file(file) ⇒ Object
37 38 39 |
# File 'lib/chef/digester.rb', line 37 def checksum_for_file(file) generate_checksum(file) end |
#generate_checksum(file) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/chef/digester.rb', line 41 def generate_checksum(file) if file.is_a?(StringIO) checksum_io(file, OpenSSL::Digest.new("SHA256")) else checksum_file(file, OpenSSL::Digest.new("SHA256")) end end |
#generate_md5_checksum(io) ⇒ Object
57 58 59 |
# File 'lib/chef/digester.rb', line 57 def generate_md5_checksum(io) checksum_io(io, ::Digest::MD5.new) end |
#generate_md5_checksum_for_file(file) ⇒ Object
53 54 55 |
# File 'lib/chef/digester.rb', line 53 def generate_md5_checksum_for_file(file) checksum_file(file, ::Digest::MD5.new) end |
#validate_checksum(*args) ⇒ Object
33 34 35 |
# File 'lib/chef/digester.rb', line 33 def validate_checksum(*args) self.class.validate_checksum(*args) end |