aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula.rb
diff options
context:
space:
mode:
authorJack Nagel2013-10-04 21:19:15 -0500
committerJack Nagel2013-10-04 21:19:15 -0500
commit86e6ff5e8044cb1f784c9c54c940e2bf269ec558 (patch)
tree8c16d02860970f539cbf6738becaecafc732561f /Library/Homebrew/formula.rb
parent1f973c30844eb7634d75d8b559a9265f0fc6c8f7 (diff)
downloadhomebrew-86e6ff5e8044cb1f784c9c54c940e2bf269ec558.tar.bz2
Check types in Formula#==
Comparing two objects should not raise an exception, even if they have different types. The semantics of #== are now the same as #eql?, so make one an alias.
Diffstat (limited to 'Library/Homebrew/formula.rb')
-rw-r--r--Library/Homebrew/formula.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 09ddf45ff..391b3b322 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -292,12 +292,11 @@ class Formula
@pin.unpin
end
- def == b
- name == b.name
- end
- def eql? b
- self == b and self.class.equal? b.class
+ def == other
+ instance_of?(other.class) && name == other.name
end
+ alias_method :eql?, :==
+
def hash
name.hash
end