diff --git a/lib/finance/cashflows.rb b/lib/finance/cashflows.rb index 985ca36..ffc1996 100644 --- a/lib/finance/cashflows.rb +++ b/lib/finance/cashflows.rb @@ -22,7 +22,7 @@ class Function values.each do |key, value| define_method key do - BigDecimal.new value + BigDecimal(value) end end @@ -33,7 +33,7 @@ def initialize(transactions, function) def values(x) value = @transactions.send(@function, Flt::DecNum.new(x[0].to_s)) - [ BigDecimal.new(value.to_s) ] + [ BigDecimal(value.to_s) ] end end diff --git a/lib/finance/decimal.rb b/lib/finance/decimal.rb index 28a72d4..1bbdec5 100644 --- a/lib/finance/decimal.rb +++ b/lib/finance/decimal.rb @@ -7,7 +7,7 @@ end DecNum.context.define_conversion_to(BigDecimal) do |x| - BigDecimal.new(x.to_s) + BigDecimal(x.to_s) end class Numeric