RubyMoney/money — pull request #148 by enebo (2012-02-23 17:19:57+00:00)
Title: Fix issues 146 and 147 by making on-the-fly decimal place calc + cache

I felt responsible for fixing these issues since my last pull request caused these reports.

I submit this as an alternate fix for issues 146 and 147. It uses integer math to calculate unknown decimal places and then stores it into the map (cache) so successive calls do not take the repeated division hit (which really was probably less intensive than the old method calling to_s on a float -- but still caching is cool).

I also added some specs to cover decimal_places including making a wacky subunits_to_units value which is a value which I think will never ever be pre-seeded into the cache.

One last thing. I know I have commit rights for this, but I would prefer someone to look this over first :)