lib/money/parser/fuzzy.rb in shopify-money-2.2.2 vs lib/money/parser/fuzzy.rb in shopify-money-3.0.0
- old
+ new
@@ -90,12 +90,11 @@
number = input.scan(NUMERIC_REGEX).flatten.first
number = number.to_s.strip
if number.empty?
- if Money.config.legacy_deprecations && !strict
- Money.deprecate("invalid money strings will raise in the next major release \"#{input}\"")
+ if !strict
return '0'
else
raise MoneyFormatError, "invalid money string: #{input}"
end
end
@@ -118,13 +117,11 @@
if amount = number[COMMA_DECIMAL_REGEX]
return amount.tr(ESCAPED_NON_COMMA_MARKS, '').sub(',', '.')
end
- if Money.config.legacy_deprecations && !strict
- Money.deprecate("invalid money strings will raise in the next major release \"#{input}\"")
- else
+ if strict
raise MoneyFormatError, "invalid money string: #{input}"
end
normalize_number(number, marks, currency)
end
@@ -157,14 +154,9 @@
# 0 before the final mark indicates last digits are decimals
# Example: 0,23
if digits.first.to_i.zero?
return true
- end
-
- # legacy support for 1.000 USD
- if digits.last.size == 3 && digits.first.size <= 3 && currency.minor_units < 3
- return false
end
# The last mark matches the one used by the provided currency to delimiter decimals
currency.decimal_mark == last_mark
end