Skip to content

Commit

Permalink
Fix Comparable#== for weird values
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Apr 16, 2013
1 parent cc6dcca commit 3e01ffd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib-topaz/comparable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ def <=(other)
end

def ==(other)
return (self <=> other) == 0
begin
compared = (self <=> other)
rescue StandardError
return false
end

return compared == 0
end

def between?(min, max)
Expand Down
1 change: 0 additions & 1 deletion spec/tags/core/comparable/equal_value_tags.txt

This file was deleted.

0 comments on commit 3e01ffd

Please sign in to comment.