Skip to content

Commit

Permalink
Merge pull request #26732 from matthewd/fixnum-warning
Browse files Browse the repository at this point in the history
Fixnum and Bignum are deprecated in Ruby trunk
  • Loading branch information
matthewd committed Oct 8, 2016
2 parents fb4dc32 + cb0452e commit 253ddeb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions activejob/lib/active_job/arguments.rb
Expand Up @@ -34,8 +34,8 @@ class SerializationError < ArgumentError; end
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.
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/query_cache_test.rb
Expand Up @@ -138,7 +138,7 @@ def test_cache_does_not_wrap_string_results_in_arrays
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
Expand Down
Expand Up @@ -134,7 +134,7 @@ def to_formatted_s(*args)
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
Expand Down
4 changes: 2 additions & 2 deletions activesupport/lib/active_support/xml_mini.rb
Expand Up @@ -48,8 +48,8 @@ def content_type
}

# 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 = {
Expand Down
4 changes: 2 additions & 2 deletions activesupport/test/core_ext/array/grouping_test.rb
Expand Up @@ -4,11 +4,11 @@
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
Expand Down

0 comments on commit 253ddeb

Please sign in to comment.