Match the behavior of bigdecimal after https://github.com/ruby/bigdecimal/pull/55

This commit is contained in:
Rafael Mendonça França 2017-02-24 19:28:41 -05:00
parent 68926798a5
commit 0683552b15
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948

@ -24,7 +24,11 @@ def cast_value(value)
when ::Numeric
BigDecimal(value, precision || BIGDECIMAL_PRECISION)
when ::String
value.to_d rescue BigDecimal(0)
begin
value.to_d
rescue ArgumentError
BigDecimal(0)
end
else
if value.respond_to?(:to_d)
value.to_d