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

Updated for Ruby 2.4 Support #301

Merged

Conversation

twosevenzero
Copy link

Description

::Fixnum is deprecated in Ruby 2.4. Updated with kind_of?(Integer).

Motivation and Context

Just a minor update to stop warnings for deprecated features.

How Has This Been Tested?

Ported the changes from the rapid7/rex-mime project.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

@@ -59,7 +59,7 @@ def add(var, val)
end

def remove(idx)
if (idx.class == ::Fixnum)
if idx.kind_of?(Integer)

Choose a reason for hiding this comment

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

Prefer Object#is_a? over Object#kind_of?.

@@ -36,7 +36,7 @@ def to_s
end

def find(idx)
if (idx.class == ::Fixnum)
if idx.kind_of?(Integer)

Choose a reason for hiding this comment

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

Prefer Object#is_a? over Object#kind_of?.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think these methods do the exact same thing and I have no preference on which one to use. I could not find a definitive answer on which one is "more correct" with a quick search. Since this is just a port of changes from upstream rex-mime project, I am okay ignoring hound in this case.

@sgreen-r7
Copy link
Contributor

@twosevenzero i'm fine with this, and routes to a handful of fixes/updates we need to include for Ruby2.4

I'm going to create a new branch to target and merge your PR into there.

Thanks again for this PR, and look forward to that branch removing any/most deprecation warnings.

@sgreen-r7 sgreen-r7 changed the base branch from master to ruby_2_4_upgrades October 3, 2017 20:24
@sgreen-r7 sgreen-r7 merged commit 6f29617 into rapid7:ruby_2_4_upgrades Oct 3, 2017
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.

4 participants