Ruby 1.8.7 Reference Manual > All Libraries > library rational > class Rational > coerce
coerce(other) -> Array自身と other が同じクラスになるよう、自身か other を変換し [other, self] という 配列にして返します。
例:
Rational(1).coerce(2) # => [Rational(2, 1), Rational(1, 1)] Rational(1).coerce(2.2) # => [2.2, 1.0]