Skip to content

Commit

Permalink
Do not use safe navigation operator for compatibility with Ruby < 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tweymuth committed Sep 5, 2019
1 parent b29399c commit 81881c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Expand Up @@ -40,4 +40,6 @@ Style/NumericLiterals:
Style/Documentation:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/SafeNavigation:
Enabled: false
4 changes: 2 additions & 2 deletions lib/money/money.rb
Expand Up @@ -592,7 +592,7 @@ def format(*rules)
# @return [String]
#
def thousands_separator
(locale_backend&.lookup(:thousands_separator, currency)) ||
(locale_backend && locale_backend.lookup(:thousands_separator, currency)) ||
Money::Formatter::DEFAULTS[:thousands_separator]
end

Expand All @@ -601,7 +601,7 @@ def thousands_separator
# @return [String]
#
def decimal_mark
(locale_backend&.lookup(:decimal_mark, currency)) ||
(locale_backend && locale_backend.lookup(:decimal_mark, currency)) ||
Money::Formatter::DEFAULTS[:decimal_mark]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/money/money/formatter.rb
Expand Up @@ -374,7 +374,7 @@ def format_decimal_part(value)
def lookup(key)
return rules[key] || DEFAULTS[key] if rules.key?(key)

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

def regexp_format
Expand Down

0 comments on commit 81881c2

Please sign in to comment.