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

Fix deprecated warnings in Ruby 2.4.0+ #36

Closed
wants to merge 1 commit into from

Conversation

koic
Copy link

@koic koic commented Dec 1, 2016

Ruby 2.4.0 unifies Fixnum and Bignum into Integer.

https://bugs.ruby-lang.org/issues/12005

Fix following deprecated warnings in Ruby 2.4.0-preview3.

warning: constant ::Fixnum is deprecated

Thanks.

@@ -28,7 +28,7 @@ def initialize(*args)
unless Diff::LCS::Change.valid_action?(@action)
raise "Invalid Change Action '#{@action}'"
end
raise "Invalid Position Type" unless @position.kind_of? Fixnum
raise "Invalid Position Type" unless @position.kind_of? Integer
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather see this in the same way that I saw a different fix in minitest;

class Diff::LCS::Change
  IntClass = 1.class # :nodoc:

  
  raise "Invalid Position Type" unless @position.kind_of? IntClass
end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. It seems to me that it is used when we want to change behavior in 2.4 and 2.3 or lower.
However, Object#kind_of? (NOT Object#instance_of?) has been used here. Therefore, I think that it is better to use Integer as it is. Integer is a super class of Fixnum, so I think that is simple here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @halostatue, could you reply for above @koic comment?
I really hope that this issue is fixed, and bumped (released), because this is one of the reason that cucumber is not supported on Ruby 2.4.

Thank you.

halostatue added a commit that referenced this pull request Jan 11, 2017
halostatue added a commit that referenced this pull request Jan 11, 2017
@halostatue halostatue mentioned this pull request Jan 11, 2017
halostatue added a commit that referenced this pull request Jan 11, 2017
- Updated testing and gem infrastructure.
- Cleaning up documentation.
- Modernizing specs.
- Silence Ruby 2.4 Fixnum deprecation warnings. Fixes #36, #38.
- Ensure test dependencies are loaded. Fixes #33, #34 so that specs can be run
  independently.
- Fix issue #1 with incorrect intuition of patch direction. Tentative fix, but
  the failure cases pass now.
@koic koic deleted the integer_unification branch January 19, 2017 02:01
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

3 participants