Currency Support
elfassy opened this issue · 1 comments
elfassy commented
- Support for passing a currency/amount
Money.new(10.00, 'USD')
- Allow a default currency
Money.default_currency = 'USD'
Money.new(10.00) == Money.new(10.00, 'USD')
- Raise on cross currency computation
Money.new(1, 'USD') + Money.new(1, 'CAD') #=> raise
-
Deprecate
from_cents
in favor offrom_subunits
Will divide by the value by the number of subunits, not always 100 -
to_s will show the correct number of subunits
Money.new('100', 'JPY').to_s #=> '100'
Money.new('100', 'SLL').to_s #=> '100.000'
Money.new('100', 'JPY').to_s(:legacy_dollars) #=> '100.00'
Money.new('100', 'SLL').to_s(:legacy_dollars) #=> '100.00'
- subunits to format with currency
Money.new(100, 'JPY').subunits #=> 100
Money.new(100, 'USD').subunits #=> 10000
bdewater commented
I think we can call this done 😄