class Numeric
Public Instance Methods
to_money(currency = nil)
click to toggle source
Converts this numeric to a Money
object in the default currency. It multiplies the numeric value by 100 and treats that as cents.
NOTE!!! This is overriden as per the default Money
.to_money because it assumes a different default currency…
100.to_money =>
# File lib/money_extensions/numeric.rb, line 15
def to_money(currency = nil)
::Money.new((self * 100).round, currency || Money.default_currency)
end