Option does not need to be Comparable

This commit is contained in:
Jack Nagel 2014-07-03 19:29:18 -05:00
parent 7d8a901f7a
commit aad09a5a63
2 changed files with 2 additions and 4 deletions

View File

@ -1,8 +1,6 @@
require 'set'
class Option
include Comparable
attr_reader :name, :description, :flag
def initialize(name, description=nil)
@ -20,9 +18,10 @@ class Option
name <=> other.name
end
def eql?(other)
def ==(other)
instance_of?(other.class) && name == other.name
end
alias_method :eql?, :==
def hash
name.hash

View File

@ -21,7 +21,6 @@ class OptionTests < Homebrew::TestCase
refute_equal bar, @option
assert_eql @option, foo
refute_eql @option, bar
assert_operator bar, :<, foo
end
def test_strips_leading_dashes