Merge pull request #34767 from y-yagi/fix_convert_string_to_bigdecimal

Use BigDecimal provided methods to convert String to BigDecimal
This commit is contained in:
Yuji Yaginuma 2018-12-21 17:58:57 +09:00 committed by GitHub
commit 5abe612b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,11 +68,7 @@ def content_type
"float" => Proc.new { |float| float.to_f },
"decimal" => Proc.new do |number|
if String === number
begin
BigDecimal(number)
rescue ArgumentError
BigDecimal(number.to_f.to_s)
end
number.to_d
else
BigDecimal(number)
end