bfoz / units-ruby

Add support for units of measure to Ruby's Numeric class
BSD 2-Clause "Simplified" License
5 stars 3 forks source link

Fix operators on unpatched literals #4

Closed bfoz closed 12 years ago

bfoz commented 12 years ago

At the moment something like 3.meters * 4 works, but 3 * 4.meters doesn't. The bare 3 doesn't have the proper multiplication method to call, which results in dropping the units.

bfoz commented 12 years ago

Use #coerce http://blog.rubybestpractices.com/posts/rklemme/019-Complete_Numeric_Class.html