Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Minor simplification to Resource#<=>
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubb committed Feb 2, 2010
1 parent dd62d2d commit 9207bb4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/dm-core/resource.rb
Expand Up @@ -445,12 +445,11 @@ def <=>(other)
unless other.kind_of?(model.base_model)
raise ArgumentError, "Cannot compare a #{other.model} instance with a #{model} instance"
end
cmp = 0
model.default_order(repository_name).each do |direction|
cmp = direction.get(self) <=> direction.get(other)
break if cmp != 0
return cmp if cmp.nonzero?
end
cmp
0
end

# Returns hash value of the object.
Expand Down

0 comments on commit 9207bb4

Please sign in to comment.