self + other -> Rational | Float
self に other を足した値(=和)を返します。
self
other
Rational オブジェクトを左項とする算術演算子 + はこのメソッドの呼び出しになります。
Rational
+
other に Float を指定した場合は、計算結果を Float で返します。
r = Rational(3, 4) p r + Rational(1, 2) # => (5/4) p r + 1 # => (7/4) p r + 0.5 # => 1.25