Class: Numeric Private

Inherits:
Object
  • Object
show all
Defined in:
lib/money_attribute/core_ext/numeric.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Convenience method for converting numeric values to Mint::Money.

Instance Method Summary collapse

Instance Method Details

#to_money(currency = MoneyAttribute.default_currency) ⇒ Mint::Money

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts the numeric value to a Mint::Money value.

Examples:

42.5.to_money('USD') # => Mint::Money(42.5, 'USD')

Parameters:

Returns:

  • (Mint::Money)


16
# File 'lib/money_attribute/core_ext/numeric.rb', line 16

def to_money(currency = MoneyAttribute.default_currency) = Money.from(self, currency)