Bug #3075

Integer gets turned into Float in Rational

Added by d-snp (Tinco Andringa) about 10 years ago. Updated about 9 years ago.

Third Party's Issue
ruby -v:
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin9.7.0]


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,

Greetings, Tinco


Updated by d-snp (Tinco Andringa) about 10 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.


Updated by marcandre (Marc-Andre Lafortune) about 10 years ago

  • Status changed from Open to Third Party's Issue



Also available in: Atom PDF