lib/monetize/parser.rb in monetize-1.9.3 vs lib/monetize/parser.rb in monetize-1.9.4
- old
+ new
@@ -80,12 +80,12 @@
def apply_sign(negative, amount)
negative ? amount * -1 : amount
end
def compute_currency
- matches = input.match(currency_symbol_regex)
- CURRENCY_SYMBOLS[matches[:symbol]] if matches
+ match = input.match(currency_symbol_regex)
+ CURRENCY_SYMBOLS[match.to_s] if match
end
def extract_major_minor(num, currency)
used_delimiters = num.scan(/[^\d]/).uniq
@@ -151,9 +151,9 @@
major, minor = num.split(delimiter)
[major, minor || '00']
end
def currency_symbol_regex
- /(?<symbol>#{regex_safe_symbols})/
+ /(?<![A-Z])(#{regex_safe_symbols})(?![A-Z])/i
end
end
end