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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/diff/lcs/change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.

end

def inspect
Expand Down Expand Up @@ -115,10 +115,10 @@ def initialize(*args)
unless Diff::LCS::Change.valid_action?(@action)
raise "Invalid Change Action '#{@action}'"
end
unless @old_position.nil? or @old_position.kind_of? Fixnum
unless @old_position.nil? or @old_position.kind_of? Integer
raise "Invalid (Old) Position Type"
end
unless @new_position.nil? or @new_position.kind_of? Fixnum
unless @new_position.nil? or @new_position.kind_of? Integer
raise "Invalid (New) Position Type"
end
end
Expand Down