Skip to content

Commit

Permalink
dry
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklozon committed Jun 1, 2021
1 parent 18cae53 commit 47c7285
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/money/money/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,9 @@ def to_s
def thousands_separator
val = lookup :thousands_separator

if val == true
val = (Money.locale_backend && Money.locale_backend.lookup(:thousands_separator, currency)) || DEFAULTS[key]
end
return val unless val == true

val
lookup_default :thousands_separator
end

def decimal_mark
Expand Down Expand Up @@ -380,6 +378,10 @@ def format_decimal_part(value)
def lookup(key)
return rules[key] || DEFAULTS[key] if rules.has_key?(key)

lookup_default key
end

def lookup_default(key)
(Money.locale_backend && Money.locale_backend.lookup(key, currency)) || DEFAULTS[key]
end

Expand Down

0 comments on commit 47c7285

Please sign in to comment.