NYC Standup Roundup – Week of 4/12

Help

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.

Interesting

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:

2 Comments

Thanks for the `BigDecimal` tips, really useful. However although `to_d` works for me with 1.8.7 p173 it’s failing with “undefined method `BigDecimal’ for 3.14159265:Float” with 1.8.7 p249 and 1.9.2. Has it been removed?

Ben

April 19, 2010 at 2:46 am

John Pignata says:

Hi Ben — That smells like a bug. We’re using it with p174. From that exception it just seems broken. You may want to poke ruby-core and ask what’s up.