Class: Chef::Digester

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/chef/digester.rb

Class Method Summary collapse

Instance Method Summary collapse

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