diff options
| author | Jack Nagel | 2013-01-13 19:51:19 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-01-13 21:01:15 -0600 |
| commit | e629f14d56b803ffbc7f3470175f2b021a8816eb (patch) | |
| tree | a2a68e1157263a5a7761f43702933af926157ab7 /Library/Homebrew/dependencies.rb | |
| parent | 2d445d54b5110e03b6a089fed25865f1d02bfed4 (diff) | |
| download | brew-e629f14d56b803ffbc7f3470175f2b021a8816eb.tar.bz2 | |
Remove <=> from Dependency interface
It is important that dep equality corresponds to the name attribute, but
we may want to use the Comparable interface to sort them by installation
order in the future. Code that needs to sort them alphabetically should
just use sort_by.
Diffstat (limited to 'Library/Homebrew/dependencies.rb')
| -rw-r--r-- | Library/Homebrew/dependencies.rb | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index 8b4916279..623591c78 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -145,27 +145,23 @@ class Dependency def initialize(name, *tags) @name = name - @tags = [tags].flatten.compact - end - - def hash - @name.hash + @tags = tags.flatten.compact end def to_s - @name + name end def ==(other) - @name == other.to_s + name == other.name end - def <=>(other) - @name <=> other.to_s + def eql?(other) + other.is_a?(self.class) && hash == other.hash end - def eql?(other) - other.is_a? self.class and hash == other.hash + def hash + name.hash end end @@ -199,7 +195,7 @@ class Requirement end def eql?(other) - other.is_a? self.class and hash == other.hash + other.is_a?(self.class) && hash == other.hash end def hash |
