Module: Chef::Mixin::Checksum

Instance Method Summary collapse

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

Returns:

  • (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