L
Lucas Carlson
I have also created a new library to add units to numbers in Ruby:
gem install units
http://units.rubyforge.org/
It is extremely simple to use:
require 'units/standard'
1.lb.to_ounces # => 16.0
require 'units/currency'
1.euro.usd # => 1.2545
1.usd.unit # => :usd
1.usd.to_yen # => 108.9 # this information is grabbed on the fly
via a SOAP call
1.usd.to_yet.unit # => :yen
It is also very simple to add both static and dynamic conversions on
your own via add_unit_conversions and add_unit_aliases.
I hope you find this library useful too.
gem install units
http://units.rubyforge.org/
It is extremely simple to use:
require 'units/standard'
1.lb.to_ounces # => 16.0
require 'units/currency'
1.euro.usd # => 1.2545
1.usd.unit # => :usd
1.usd.to_yen # => 108.9 # this information is grabbed on the fly
via a SOAP call
1.usd.to_yet.unit # => :yen
It is also very simple to add both static and dynamic conversions on
your own via add_unit_conversions and add_unit_aliases.
I hope you find this library useful too.