Method: Money#default_currency

Defined in:
lib/money/money.rb

#default_currencyMoney::Currency

Returns The default currency, which is used when Money.new is called without an explicit currency argument. The default value is Currency.new(“USD”). The value must be a valid Money::Currency instance.

Returns:

  • (Money::Currency)

    The default currency, which is used when Money.new is called without an explicit currency argument. The default value is Currency.new(“USD”). The value must be a valid Money::Currency instance.



152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/money/money.rb', line 152

def self.default_currency
  if @using_deprecated_default_currency
    warn '[WARNING] The default currency will change from `USD` to `nil` in the next major release. Make ' \
         'sure to set it explicitly using `Money.default_currency=` to avoid potential issues'
    @using_deprecated_default_currency = false
  end

  if @default_currency.respond_to?(:call)
    Money::Currency.new(@default_currency.call)
  else
    Money::Currency.new(@default_currency)
  end
end