diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-15 10:57:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 10:57:53 +0900 |
commit | 67b9dbcc1cfce6694ab18c9629b233979506fbf0 (patch) | |
tree | e3123654767a935bb5e9feb32f5f27720525570c /activesupport/lib | |
parent | 36291970341057bbf5f818d5ee0c5e77ab14a308 (diff) | |
parent | e4a6a23aa77185127ce9609777820fab14a689bb (diff) | |
download | rails-67b9dbcc1cfce6694ab18c9629b233979506fbf0.tar.gz rails-67b9dbcc1cfce6694ab18c9629b233979506fbf0.tar.bz2 rails-67b9dbcc1cfce6694ab18c9629b233979506fbf0.zip |
Merge pull request #31460 from yahonda/deprecated_bigdecimal_new_ap_av_aj_as_guides
Suppress `warning: BigDecimal.new is deprecated`
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/duplicable.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/number_helper/rounding_helper.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb index 1744a44df6..9bb99087bc 100644 --- a/activesupport/lib/active_support/core_ext/object/duplicable.rb +++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb @@ -108,8 +108,8 @@ require "bigdecimal" class BigDecimal # BigDecimals are duplicable: # - # BigDecimal.new("1.2").duplicable? # => true - # BigDecimal.new("1.2").dup # => #<BigDecimal:...,'0.12E1',18(18)> + # BigDecimal("1.2").duplicable? # => true + # BigDecimal("1.2").dup # => #<BigDecimal:...,'0.12E1',18(18)> def duplicable? true end diff --git a/activesupport/lib/active_support/number_helper/rounding_helper.rb b/activesupport/lib/active_support/number_helper/rounding_helper.rb index a5b28296a2..2ad8d49c4e 100644 --- a/activesupport/lib/active_support/number_helper/rounding_helper.rb +++ b/activesupport/lib/active_support/number_helper/rounding_helper.rb @@ -36,7 +36,7 @@ module ActiveSupport return 0 if number.zero? digits = digit_count(number) multiplier = 10**(digits - precision) - (number / BigDecimal.new(multiplier.to_f.to_s)).round * multiplier + (number / BigDecimal(multiplier.to_f.to_s)).round * multiplier end def convert_to_decimal(number) |