Ruby 3.3 リファレンスマニュアル

instance method Rational#coerce

coerce(other) -> Array[permalink][rdoc][edit]

selfother が同じクラスになるよう、selfother を変換し [other, self] という配列にして返します。

[PARAM] other:
比較または変換するオブジェクト
p Rational(1).coerce(2) # => [(2/1), (1/1)]
p Rational(1).coerce(2.2) # => [2.2, 1.0]