From 06ee20e929656d41c301f61fd447105c3840e410 Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Tue, 6 May 2014 00:08:02 -0400 Subject: diff-lcs 1.3 - 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. --- lib/diff/lcs/change.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/diff/lcs/change.rb') 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 -- cgit v1.2.1