Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > rationalライブラリ > Integerクラス > to_r

instance method Integer#to_r

to_r -> Rational [added by rational]

自身を Rational に変換します。

例:

1.to_r        # => Rational(1, 1)
(1<<64).to_r  # => Rational(18446744073709551616, 1)
class Integer