<=>

rational numeric รข -1, 0, +1 or nil
Instance Public methods

Performs comparison and returns -1, 0, or +1.

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
doc_ruby_on_rails
2015-05-01 03:35:25
Comments
Leave a Comment

Please login to continue.