Parent

Methods

Numeric

Open Numeric to add new method.

Public Instance Methods

to_money(currency = nil) click to toggle source

Converts this numeric into a Money object in the given currency.

@param [Currency, String, Symbol] currency

The currency to set the resulting +Money+ object to.

@return [Money]

@example

100.to_money                   #=> #<Money @fractional=10000>
100.37.to_money                #=> #<Money @fractional=10037>
BigDecimal.new('100').to_money #=> #<Money @fractional=10000>

@see Money.from_numeric

# File lib/money/core_extensions.rb, line 18
def to_money(currency = nil)
  Money.from_numeric(self, currency || Money.default_currency)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.