brew/Library/Homebrew/checksum.rb

24 lines
411 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2020-08-17 02:58:03 +02:00
# A formula's checksum.
#
# @api private
class Checksum
extend Forwardable
attr_reader :hash_type, :hexdigest
TYPES = [:sha256].freeze
2013-04-07 00:49:56 -05:00
def initialize(hash_type, hexdigest)
@hash_type = hash_type
@hexdigest = hexdigest
end
delegate [:empty?, :to_s] => :@hexdigest
2013-04-07 00:49:56 -05:00
def ==(other)
hash_type == other&.hash_type && hexdigest == other.hexdigest
end
end