Skip to content

Commit

Permalink
Fixed Bignum#<=> with an object instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ford authored and Evan Phoenix committed Nov 19, 2010
1 parent dc9fa7a commit 0215a2c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion kernel/bootstrap/bignum.rb
Expand Up @@ -134,7 +134,16 @@ def ==(o)

def <=>(other)
Ruby.primitive :bignum_compare
super(other)

# We do not use redo_compare here because Ruby does not
# raise if any part of the coercion or comparison raises
# an exception.
begin
a, b = other.coerce self
a <=> b
rescue
return nil
end
end

# conversions
Expand Down

0 comments on commit 0215a2c

Please sign in to comment.