Module: CurrencyMath

Defined in:
lib/version.rb,
lib/currency_math.rb

Constant Summary collapse

VERSION =
'0.1.3'.freeze

Instance Method Summary collapse

Instance Method Details

#add(to_decimal, addend) ⇒ Object



9
10
11
# File 'lib/currency_math.rb', line 9

def add(to_decimal, addend)
  (to_decimal.to_d + addend.to_d).currency_string
end

#multiply(to_decimal, multiplier) ⇒ Object



5
6
7
# File 'lib/currency_math.rb', line 5

def multiply(to_decimal, multiplier)
  (to_decimal.to_d * multiplier.to_d).currency_string
end

#subtract(to_decimal, subtrahend) ⇒ Object



13
14
15
# File 'lib/currency_math.rb', line 13

def subtract(to_decimal, subtrahend)
  (to_decimal.to_d - subtrahend.to_d).currency_string
end