aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/checksums.rb
blob: defaa8bb1ef4fc6aaad2bc8439639ab3ce04d98e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Checksum
  attr_reader :hash_type, :hexdigest

  TYPES = [:md5, :sha1, :sha256]

  def initialize type=:sha1, val=nil
    @hash_type = type
    @hexdigest = val.to_s
  end

  def empty?
    @hexdigest.empty?
  end

  def to_s
    @hexdigest
  end

  def == other
    @hash_type == other.hash_type and @hexdigest == other.hexdigest
  end
end