brew/Library/Homebrew/checksum.rb

25 lines
425 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: true
# 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