From 9600d2f0112e4a3082d71107cb7474e2212a3a34 Mon Sep 17 00:00:00 2001 From: yuhei mukoyama Date: Fri, 1 Feb 2019 13:54:44 +0900 Subject: [PATCH] `BigDecimal.new` is deprecated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A warning is displayed when running with ruby ​​2.6 `warning: BigDecimal.new is deprecated; use BigDecimal() method instead.` --- lib/rfm/metadata/field.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rfm/metadata/field.rb b/lib/rfm/metadata/field.rb index d6de1ce6..0ab6107a 100644 --- a/lib/rfm/metadata/field.rb +++ b/lib/rfm/metadata/field.rb @@ -93,7 +93,7 @@ def coerce(value) # So on european servers a number value of '1.200,50' is considered valid and interpreted as 1200.5 # To support this, :decimal_separator can be configured and any other characters than digits and the separator are ignored sep = layout_object.state[:decimal_separator] || '.' - BigDecimal.new(value.to_s.gsub(/[^-^\d#{Regexp.quote(sep)}]/,'').tr(sep,'.')) + BigDecimal(value.to_s.gsub(/[^-^\d#{Regexp.quote(sep)}]/,'').tr(sep,'.')) when "date" then Date.strptime(value, resultset_meta.date_format) when "time" then DateTime.strptime("1/1/-4712 #{value}", "%m/%d/%Y #{resultset_meta.time_format}") when "timestamp" then DateTime.strptime(value, resultset_meta.timestamp_format)