Integer gets turned into Float in Rational
This bug is as weird as the subject sounds:
I'm sorry it uses a method from activesupport, I couldn't trigger the bug without activesupport, yet because it seems to do this weird object magic trick in between method calls I think it has to do something with ruby.
I hope this makes sense to you,
Updated by d-snp (Tinco Andringa) over 9 years ago
I figured it out. Since the Duration object responds to .kind_of? Integer it gets turned into a rational, and then the function is recursed. Because @numerator is a Bignum and a.numerator a Duration, coerce gets called, and both are turned into floats. Duration should've overrode coerce, the problem lies with active_support so this ticket can be closed.