Kernel.Rational raises TypeError though given denominator returns 1 by to_int
Is it an intentional behavior?
class << (o = Object.new) def to_int 1 end end Rational(1, o) #=> TypeError: not an integer
Updated by jeremyevans0 (Jeremy Evans) almost 2 years ago
I'm not sure if this is considered a bug or not. Rational will already try to convert numerator and denominator via
to_r. However, if we do want to convert via
to_r is not defined, the attached patch should implement it.