diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 517c9c92ac..19ea21f1a1 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -75,9 +75,10 @@ class Requirement self.class.env_proc end - def eql?(other) + def ==(other) instance_of?(other.class) && name == other.name && tags == other.tags end + alias_method :eql?, :== def hash name.hash ^ tags.hash diff --git a/Library/Homebrew/test/test_requirement.rb b/Library/Homebrew/test/test_requirement.rb index a3fd117ebf..a4400feb3d 100644 --- a/Library/Homebrew/test/test_requirement.rb +++ b/Library/Homebrew/test/test_requirement.rb @@ -129,12 +129,14 @@ class RequirementTests < Homebrew::TestCase def test_eql a, b = Requirement.new, Requirement.new + assert_equal a, b assert_eql a, b assert_equal a.hash, b.hash end def test_not_eql a, b = Requirement.new([:optional]), Requirement.new + refute_equal a, b refute_eql a, b refute_equal a.hash, b.hash end