Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > rationalライブラリ > Rationalクラス > ==
self == other -> bool
数値として等しいか判定します。
例:
Rational(2, 3) == Rational(2, 3) # => true Rational(5) == 5 # => true Rational(0) == 0.0 # => true Rational(1, 3) == 0.33 # => false Rational(1, 2) == '1/2' # => false