An old rational/mathn bug persists in ruby 1.8
preview 2. This bug was also present in 1.6.7 and
1.6.8 and probably earlier. I think I reported this
bug about a year ago, but somehow it slipped through
the cracks.
After the mathn unification, integers are supposed
to respond to the numerator and denominator methods.
But the denominator method has been undermined by a
typo.
irb(main):001:0> require ‘mathn’
true
irb(main):002:0> 3.numerator
3
irb(main):003:0> 3.denominator
NoMethodError: undefined method `denominator’ for 3:Fixnum
from (irb):3
irb(main):004:0> 3.denomerator
1
The culprit is in rational.rb, where we find this
code:
class Integer
def numerator
self
end
def denomerator # typo! “denomerator” is not a word!
1
end
…more methods
end
Regards, Bret