Cliff Moon on 6 Sep 2007 17:07:33 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] require 'rational'

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?
To unsubscribe or change your settings, visit: