[PhillyOnRails] require 'rational'
Cliff Moon
cliff at chariotsolutions.com
Thu Sep 6 10:07:17 MST 2007
Using the ruby rational library has side effects. The rational library
duck punches the arithmetic methods on Fixnum and friends, thus making
simple integer arithmetic return rational numbers. I've found an
unintended consequence in the Rails integration testing library,
specifically Integration::Session#redirect? which does status/100 == 3
to test for a redirect code.
So basically I've consigned myself to duck punching the original
arithmetic methods back onto Fixnum, but I wonder if anyone would care
to chime in with a more elegant solution. Maybe there's an alternative
rational library out there that behaves... more rationally?
More information about the talk
mailing list