Class: Checksum

Inherits:
Object show all
Defined in:
Library/Homebrew/checksum.rb

Constant Summary

TYPES =
[:sha256].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash_type, hexdigest) ⇒ Checksum

Returns a new instance of Checksum



7
8
9
10
# File 'Library/Homebrew/checksum.rb', line 7

def initialize(hash_type, hexdigest)
  @hash_type = hash_type
  @hexdigest = hexdigest
end

Instance Attribute Details

#hash_typeObject (readonly)

Returns the value of attribute hash_type



2
3
4
# File 'Library/Homebrew/checksum.rb', line 2

def hash_type
  @hash_type
end

#hexdigestObject (readonly) Also known as: to_s

Returns the value of attribute hexdigest



2
3
4
# File 'Library/Homebrew/checksum.rb', line 2

def hexdigest
  @hexdigest
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'Library/Homebrew/checksum.rb', line 16

def ==(other)
  hash_type == other.hash_type && hexdigest == other.hexdigest
end

#empty?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'Library/Homebrew/checksum.rb', line 12

def empty?
  hexdigest.empty?
end