Does anybody have any good techniques for dealing with STDOUT/STDERR and exception handling when shelling out in Ruby on Windows?
Nobody did. Do you? Please share in the comments.
A pair ran system updates on their Snow Leopard box which caused bunch of test failures in their project. Most of the failures were occurring around the parts of the application that used BigDecimal. After digging they found:
>> BigDecimal.new("1.01").to_f => 1.1
Oops! Looks like Apple shipped Ruby 1.8.7 p173 with a recent update. p173 has a bug that some dude introduced into BigDecimal. The fix was to update to p174 which was released quickly after this was discovered.
While on the subject, BigDecimal is kind of a drag. Its #inspect output is inhumane and new’ing up BigDecimal objects requires an ugly call to its constructor. A Pivot recommended using the undocumented bigdecimal/util which adds a convenience method to Float for creating new BigDecimals:
>> require 'bigdecimal/util' >> 3.14159265.to_d => #<BigDecimal:10056bea8,'0.314159265E1',12(16)>
And a nickel’s worth of free advice?
>> BigDecimal.send :alias_method, :inspect, :to_s >> 98.6.to_d => 0.986E2
Unless you prefer: