Module: Chef::Mixin::Checksum
- Included in:
- Cookbook::SyntaxCheck, Provider::File, Provider::Package::Cab, Provider::Package::Msu, Provider::Package::Windows, Provider::RegistryKey
- Defined in:
- lib/chef/mixin/checksum.rb
Instance Method Summary collapse
- #checksum(file) ⇒ Object
- #checksum_match?(ref_checksum, diff_checksum) ⇒ Boolean
- #short_cksum(checksum) ⇒ Object
Instance Method Details
#checksum(file) ⇒ Object
25 26 27 |
# File 'lib/chef/mixin/checksum.rb', line 25 def checksum(file) Chef::Digester.checksum_for_file(file) end |
#checksum_match?(ref_checksum, diff_checksum) ⇒ Boolean
35 36 37 38 39 |
# File 'lib/chef/mixin/checksum.rb', line 35 def checksum_match?(ref_checksum, diff_checksum) return false if ref_checksum.nil? || diff_checksum.nil? ref_checksum.casecmp?(diff_checksum) end |
#short_cksum(checksum) ⇒ Object
29 30 31 32 33 |
# File 'lib/chef/mixin/checksum.rb', line 29 def short_cksum(checksum) return "none" if checksum.nil? checksum.slice(0, 6) end |