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


28
29
30
# File 'lib/chef/digester.rb', line 28

def self.checksum_for_file(*args)
  instance.checksum_for_file(*args)
end

.generate_md5_checksum_for_file(*args) ⇒ Object


48
49
50
# File 'lib/chef/digester.rb', line 48

def self.generate_md5_checksum_for_file(*args)
  instance.generate_md5_checksum_for_file(*args)
end

Instance Method Details

#checksum_for_file(file) ⇒ Object


36
37
38
# File 'lib/chef/digester.rb', line 36

def checksum_for_file(file)
  generate_checksum(file)
end

#generate_checksum(file) ⇒ Object


40
41
42
43
44
45
46
# File 'lib/chef/digester.rb', line 40

def generate_checksum(file)
  if file.is_a?(StringIO)
    checksum_io(file, OpenSSL::Digest::SHA256.new)
  else
    checksum_file(file, OpenSSL::Digest::SHA256.new)
  end
end

#generate_md5_checksum(io) ⇒ Object


56
57
58
# File 'lib/chef/digester.rb', line 56

def generate_md5_checksum(io)
  checksum_io(io, OpenSSL::Digest::MD5.new)
end

#generate_md5_checksum_for_file(file) ⇒ Object


52
53
54
# File 'lib/chef/digester.rb', line 52

def generate_md5_checksum_for_file(file)
  checksum_file(file, OpenSSL::Digest::MD5.new)
end

#validate_checksum(*args) ⇒ Object


32
33
34
# File 'lib/chef/digester.rb', line 32

def validate_checksum(*args)
  self.class.validate_checksum(*args)
end