lib/danconia/money.rb in danconia-0.2.4 vs lib/danconia/money.rb in danconia-0.2.5
- old
+ new
@@ -11,16 +11,15 @@
@amount = parse amount
@currency = Currency.find(currency_code || Danconia.config.default_currency, exchange)
@exchange = exchange
end
- def format decimals: @decimals
- ActiveSupport::NumberHelper.number_to_currency amount, precision: decimals, unit: currency.symbol
+ def format decimals: @decimals, **other_options
+ opts = other_options.reverse_merge precision: decimals, unit: currency.symbol
+ ActiveSupport::NumberHelper.number_to_currency amount, opts
end
- def to_s
- format
- end
+ alias to_s format
def inspect
"#{amount} #{currency.code}"
end