Flowdock
<=>(p1) public

Returns -1, 0, or +1 depending on whether rational is less than, equal to, or greater than numeric.

nil is returned if the two values are incomparable.

Rational(2, 3) <=> Rational(2, 3)  #=> 0
Rational(5)    <=> 5               #=> 0
Rational(2, 3) <=> Rational(1, 3)  #=> 1
Rational(1, 3) <=> 1               #=> -1
Rational(1, 3) <=> 0.3             #=> 1

Rational(1, 3) <=> "0.3"           #=> nil
Show source
Register or log in to add new notes.