Skip to content

Commit

Permalink
Silence Ruby 2.4 Fixnum deprecation warnings
Browse files Browse the repository at this point in the history
Fixes #36, #38.
  • Loading branch information
halostatue committed Jan 11, 2017
1 parent 68f0f4f commit ad95475
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/diff/lcs/change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# addition of an element from either the old or the new sequenced
# enumerable.
class Diff::LCS::Change
IntClass = 1.class # Fixnum is deprecated in Ruby 2.4

# The only actions valid for changes are '+' (add), '-' (delete), '='
# (no change), '!' (changed), '<' (tail changes from first sequence), or
# '>' (tail changes from second sequence). The last two ('<>') are only
Expand All @@ -28,7 +30,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? IntClass
end

def inspect
Expand Down Expand Up @@ -115,10 +117,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? IntClass
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? IntClass
raise "Invalid (New) Position Type"
end
end
Expand Down

0 comments on commit ad95475

Please sign in to comment.