Class: Money::FormattingRules

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

Instance Method Summary collapse

Constructor Details

#initialize(currency, *raw_rules) ⇒ FormattingRules

Returns a new instance of FormattingRules.


5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/money/money/formatting_rules.rb', line 5

def initialize(currency, *raw_rules)
  @currency = currency

  # support for old format parameters
  @rules = normalize_formatting_rules(raw_rules)

  @rules = default_formatting_rules.merge(@rules) unless @rules[:ignore_defaults]
  @rules = localize_formatting_rules(@rules)
  @rules = translate_formatting_rules(@rules) if @rules[:translate]
  @rules[:format] ||= determine_format_from_formatting_rules(@rules)

  warn_about_deprecated_rules(@rules)
end

Instance Method Details

#[](key) ⇒ Object


19
20
21
# File 'lib/money/money/formatting_rules.rb', line 19

def [](key)
  @rules[key]
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/money/money/formatting_rules.rb', line 23

def has_key?(key)
  @rules.has_key? key
end