coerce(other) -> Array[permalink][rdoc][edit]-
selfとotherが同じクラスになるよう、selfかotherを変換し[other, self]という配列にして返します。- [PARAM]
other: - 比較または変換するオブジェクト
p Rational(1).coerce(2) # => [(2/1), (1/1)] p Rational(1).coerce(2.2) # => [2.2, 1.0] - [PARAM]
coerce(other) -> Array[permalink][rdoc][edit]
self と other が同じクラスになるよう、self か other を変換し [other, self] という配列にして返します。
other:p Rational(1).coerce(2) # => [(2/1), (1/1)]
p Rational(1).coerce(2.2) # => [2.2, 1.0]