Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/money/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#to_moneyObject

Converts this numeric to a Money object in the default currency. It multiplies the numeric value by 100 and treats that as cents.

100.to_money => #<Money @cents=10000>
100.37.to_money => #<Money @cents=10037>


7
8
9
# File 'lib/money/core_extensions.rb', line 7

def to_money
  Money.new(self * 100)
end