Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixnum is deprecated in upcoming ruby version #329

Merged

Conversation

nimish-mehta
Copy link
Contributor

Fixnum and Bignum are being deprecated in ruby version 2.4
https://bugs.ruby-lang.org/issues/12739, use 0.class to
handle the transition

Fixnum and Bignum are being deprecated in ruby version 2.4
https://bugs.ruby-lang.org/issues/12739, use 0.class to
handle the transition
@macournoyer macournoyer merged commit 4619553 into macournoyer:master Dec 1, 2016
@macournoyer
Copy link
Owner

Thanks!

@janko
Copy link

janko commented May 4, 2017

I'm curious, why not just use Integer instead of 0.class? I thought that was the idea behind deprecation of Fixnum, that we don't have to differentiate between Fixnum and Bignum anymore.

@junaruga
Copy link
Contributor

junaruga commented May 4, 2017

@janko-m I think that it is compatibility for Ruby < 2.4.0. you can see the 0.class hack in famous rubygem packages.

Below are for Rails (rails/rails).

$ git clone https://github.com/rails/rails.git
$ cd rails
$ grep -r '0\.class' *
activerecord/test/cases/query_cache_test.rb:        assert_instance_of 0.class, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks")
activesupport/test/core_ext/array/grouping_test.rb:    Fixnum.send :private, :/ unless 0.class == Integer
activesupport/test/core_ext/array/grouping_test.rb:    Fixnum.send :public, :/ unless 0.class == Integer
activesupport/lib/active_support/core_ext/numeric/conversions.rb:if 0.class == Integer
activesupport/lib/active_support/xml_mini.rb:      TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer
activesupport/lib/active_support/xml_mini.rb:      TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer

@nimish-mehta
Copy link
Contributor Author

@janko-m @junaruga
I just tested this out: https://gist.github.com/nimish-mehta/b6b7d49711eafbb3fcb7f50fd5c79849.
Integer would have worked out just as well. I did know about this when i made the PR 😞

@ttanimichi
Copy link

Are you planning to release this in the next version?

@macournoyer
Copy link
Owner

Just released yesterday.

@KelseyDH
Copy link

KelseyDH commented Mar 2, 2018

Would it be possible to backport this fix to thin version 1.5?

The folks over at mailcatcher relying on the skinny gem don't have an easy upgrade path to later versions of thin, so this deprecation message still shows up when they use thin 1.5. So backporting this fix, or alternatively helping skinny upgrade to a newer version of thin 1.7, would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants