Module: MoneyRails::Configuration

Included in:
MoneyRails
Defined in:
lib/money-rails/configuration.rb

Overview

MoneyRails configuration module. This is extended by MoneyRails to provide configuration settings.

Constant Summary collapse

@@include_validations =
true

Instance Method Summary collapse

Instance Method Details

#configure {|_self| ... } ⇒ Object

Start a MoneyRails configuration block in an initializer.

example: Provide a default currency for the application

MoneyRails.configure do |config|
  config.default_currency = :eur
end

Yields:

  • (_self)

Yield Parameters:



16
17
18
# File 'lib/money-rails/configuration.rb', line 16

def configure
  yield self
end

#default_currency=(currency_name) ⇒ Object

Set default currency of money library



23
24
25
# File 'lib/money-rails/configuration.rb', line 23

def default_currency=(currency_name)
  Money.default_currency = Money::Currency.new(currency_name)
end

#register_currency=(currency_options) ⇒ Object

Register a custom currency



28
29
30
# File 'lib/money-rails/configuration.rb', line 28

def register_currency=(currency_options)
  Money::Currency.register(currency_options)
end