summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2013-01-19 17:27:46 -0500
committerAustin Ziegler <austin@zieglers.ca>2013-01-19 17:27:46 -0500
commit86928fa4a2ca7a91e08571a46a98fdb42aee354d (patch)
tree389ffadba044b212a23f6966b5ff8121cb59c22d
parent3965b70aef3828c10a284541f1342d0edd121827 (diff)
downloaddiff-lcs-86928fa4a2ca7a91e08571a46a98fdb42aee354d.tar.gz
Fixing an issue with the refactoring done earlier.
-rw-r--r--lib/diff/lcs.rb2
-rw-r--r--lib/diff/lcs/internals.rb50
2 files changed, 26 insertions, 26 deletions
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb
index 2af2a4e..8ae85be 100644
--- a/lib/diff/lcs.rb
+++ b/lib/diff/lcs.rb
@@ -729,7 +729,7 @@ module Diff::LCS
# Start with a new empty type of the source's class
res = src.class.new
- direction ||= Diff::LCS.__diff_direction(src, patchset)
+ direction ||= Diff::LCS::Internals.diff_direction(src, patchset)
ai = bj = 0
diff --git a/lib/diff/lcs/internals.rb b/lib/diff/lcs/internals.rb
index 286efc8..9bef560 100644
--- a/lib/diff/lcs/internals.rb
+++ b/lib/diff/lcs/internals.rb
@@ -185,31 +185,6 @@ module Diff::LCS::Internals # :nodoc:
count += 1
case change
- when Diff::LCS::Change
- # With a simplistic change, we can't tell the difference between
- # the left and right on '!' actions, so we ignore those. On '='
- # actions, if there's a miss, we miss both left and right.
- element = string ? src[change.position, 1] : src[change.position]
-
- case change.action
- when '-'
- if element == change.element
- left_match += 1
- else
- left_miss += 1
- end
- when '+'
- if element == change.element
- right_match += 1
- else
- right_miss += 1
- end
- when '='
- if element != change.element
- left_miss += 1
- right_miss += 1
- end
- end
when Diff::LCS::ContextChange
case change.action
when '-' # Remove details from the old string
@@ -247,6 +222,31 @@ module Diff::LCS::Internals # :nodoc:
end
end
end
+ when Diff::LCS::Change
+ # With a simplistic change, we can't tell the difference between
+ # the left and right on '!' actions, so we ignore those. On '='
+ # actions, if there's a miss, we miss both left and right.
+ element = string ? src[change.position, 1] : src[change.position]
+
+ case change.action
+ when '-'
+ if element == change.element
+ left_match += 1
+ else
+ left_miss += 1
+ end
+ when '+'
+ if element == change.element
+ right_match += 1
+ else
+ right_miss += 1
+ end
+ when '='
+ if element != change.element
+ left_miss += 1
+ right_miss += 1
+ end
+ end
end
break if (not limit.nil?) && (count > limit)