aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/checksum.rb
diff options
context:
space:
mode:
authorJack Nagel2013-04-07 00:49:56 -0500
committerJack Nagel2013-04-07 20:59:49 -0500
commit349cdab76fe930783b3fd3909726622a36279592 (patch)
treecff7634f54e9e834dd330d554fe433256f8258fa /Library/Homebrew/checksum.rb
parent3882603ba855f28eae698c2c24039b5e86ee5c95 (diff)
downloadbrew-349cdab76fe930783b3fd3909726622a36279592.tar.bz2
Tests for Checksum class
Diffstat (limited to 'Library/Homebrew/checksum.rb')
-rw-r--r--Library/Homebrew/checksum.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/Library/Homebrew/checksum.rb b/Library/Homebrew/checksum.rb
index 28ca023fe..a4e38e0ad 100644
--- a/Library/Homebrew/checksum.rb
+++ b/Library/Homebrew/checksum.rb
@@ -1,22 +1,19 @@
class Checksum
attr_reader :hash_type, :hexdigest
+ alias_method :to_s, :hexdigest
TYPES = [:sha1, :sha256]
- def initialize type=:sha1, val=nil
- @hash_type = type
- @hexdigest = val.to_s
+ def initialize(hash_type, hexdigest)
+ @hash_type = hash_type
+ @hexdigest = hexdigest
end
def empty?
- @hexdigest.empty?
+ hexdigest.empty?
end
- def to_s
- @hexdigest
- end
-
- def == other
- @hash_type == other.hash_type and @hexdigest == other.hexdigest
+ def ==(other)
+ hash_type == other.hash_type && hexdigest == other.hexdigest
end
end