diff options
author | Austin Ziegler <austin@zieglers.ca> | 2017-01-18 18:33:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-18 18:33:59 -0500 |
commit | 972ae416205ea8dd630d9cc32ab18aae2c577b14 (patch) | |
tree | 7325cd8e3279b71e5bc18302112e47cad3000a40 /lib/diff/lcs/change.rb | |
parent | ff796c262db5a22f14b4765c09655b4faccc132a (diff) | |
parent | 06ee20e929656d41c301f61fd447105c3840e410 (diff) | |
download | diff-lcs-972ae416205ea8dd630d9cc32ab18aae2c577b14.tar.gz |
Merge pull request #39 from halostatue/spec-cleanup
Various diff-lcs Fixes
Diffstat (limited to 'lib/diff/lcs/change.rb')
-rw-r--r-- | lib/diff/lcs/change.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/diff/lcs/change.rb b/lib/diff/lcs/change.rb index 3104a51..9229069 100644 --- a/lib/diff/lcs/change.rb +++ b/lib/diff/lcs/change.rb @@ -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 @@ -28,7 +30,7 @@ class Diff::LCS::Change 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 @@ -115,10 +117,10 @@ class Diff::LCS::ContextChange < Diff::LCS::Change 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 |