diff options
author | Matthew Draper <matthew@trebex.net> | 2016-10-08 10:50:36 +1030 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-08 10:50:36 +1030 |
commit | 253ddeb3ce435e18086804340e1b0c30fb7d43f6 (patch) | |
tree | ad85affb51255c896a09e913052f603a03dadc7b | |
parent | fb4dc3224508ba55320ecc61bf7da5f1282d6873 (diff) | |
parent | cb0452e9a50e97f8ab2100f6226fbdd47a970a34 (diff) | |
download | rails-253ddeb3ce435e18086804340e1b0c30fb7d43f6.tar.gz rails-253ddeb3ce435e18086804340e1b0c30fb7d43f6.tar.bz2 rails-253ddeb3ce435e18086804340e1b0c30fb7d43f6.zip |
Merge pull request #26732 from matthewd/fixnum-warning
Fixnum and Bignum are deprecated in Ruby trunk
5 files changed, 8 insertions, 8 deletions
diff --git a/activejob/lib/active_job/arguments.rb b/activejob/lib/active_job/arguments.rb index 41ce5f863b..23e237c1b7 100644 --- a/activejob/lib/active_job/arguments.rb +++ b/activejob/lib/active_job/arguments.rb @@ -34,8 +34,8 @@ module ActiveJob module Arguments extend self # :nodoc: - # Calls #uniq since Integer, Fixnum, and Bignum are all the same class on Ruby 2.4+ - TYPE_WHITELIST = [ NilClass, String, Integer, Fixnum, Bignum, Float, BigDecimal, TrueClass, FalseClass ].uniq + TYPE_WHITELIST = [ NilClass, String, Integer, Float, BigDecimal, TrueClass, FalseClass ] + TYPE_WHITELIST.push(Fixnum, Bignum) unless 1.class == Integer # Serializes a set of arguments. Whitelisted types are returned # as-is. Arrays/Hashes are serialized element by element. diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index 7f7faca70d..16cf2bd2d0 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -138,7 +138,7 @@ class QueryCacheTest < ActiveRecord::TestCase assert_kind_of Numeric, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks") elsif current_adapter?(:SQLite3Adapter, :Mysql2Adapter, :PostgreSQLAdapter) # Future versions of the sqlite3 adapter will return numeric - assert_instance_of Fixnum, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks") + assert_instance_of 0.class, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks") else assert_instance_of String, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks") end diff --git a/activesupport/lib/active_support/core_ext/numeric/conversions.rb b/activesupport/lib/active_support/core_ext/numeric/conversions.rb index 5ac312790d..cebfda8d31 100644 --- a/activesupport/lib/active_support/core_ext/numeric/conversions.rb +++ b/activesupport/lib/active_support/core_ext/numeric/conversions.rb @@ -134,7 +134,7 @@ module ActiveSupport::NumericWithFormat end # Ruby 2.4+ unifies Fixnum & Bignum into Integer. -if Integer == Fixnum +if 0.class == Integer Integer.prepend ActiveSupport::NumericWithFormat else Fixnum.prepend ActiveSupport::NumericWithFormat diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb index 46b91806f6..921a3447d0 100644 --- a/activesupport/lib/active_support/xml_mini.rb +++ b/activesupport/lib/active_support/xml_mini.rb @@ -48,8 +48,8 @@ module ActiveSupport } # No need to map these on Ruby 2.4+ - TYPE_NAMES["Fixnum"] = "integer" unless Fixnum == Integer - TYPE_NAMES["Bignum"] = "integer" unless Bignum == Integer + TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer + TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer end FORMATTING = { diff --git a/activesupport/test/core_ext/array/grouping_test.rb b/activesupport/test/core_ext/array/grouping_test.rb index 86c9bae131..b06f87c008 100644 --- a/activesupport/test/core_ext/array/grouping_test.rb +++ b/activesupport/test/core_ext/array/grouping_test.rb @@ -4,11 +4,11 @@ require "active_support/core_ext/array" class GroupingTest < ActiveSupport::TestCase def setup # In Ruby < 2.4, test we avoid Integer#/ (redefined by mathn) - Fixnum.send :private, :/ unless Fixnum == Integer + Fixnum.send :private, :/ unless 0.class == Integer end def teardown - Fixnum.send :public, :/ unless Fixnum == Integer + Fixnum.send :public, :/ unless 0.class == Integer end def test_in_groups_of_with_perfect_fit |