summaryrefslogtreecommitdiff
path: root/lib/diff/lcs/change.rb
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2019-01-28 00:42:50 -0500
committerAustin Ziegler <austin@zieglers.ca>2019-02-01 22:25:37 -0500
commita798f6f1dc5d41aceb236ea0aeaa113c8dc89c92 (patch)
treed9f368b89273969d87f4f5b640d855c7336f453e /lib/diff/lcs/change.rb
parent45ea1b30c7de0ad840f72afb82fd41eb2b9590db (diff)
downloaddiff-lcs-a798f6f1dc5d41aceb236ea0aeaa113c8dc89c92.tar.gz
Reintroduce Diff::LCS::Change#to_ary
- This required some level of code remediation in the main library, but all tests now pass: - Patchsets are now internally flattened one level explicitly, rather than using Array#flatten. This ensures that only the outer patchset array is flattened. Fixes #48.
Diffstat (limited to 'lib/diff/lcs/change.rb')
-rw-r--r--lib/diff/lcs/change.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/diff/lcs/change.rb b/lib/diff/lcs/change.rb
index 75e1f84..76faf83 100644
--- a/lib/diff/lcs/change.rb
+++ b/lib/diff/lcs/change.rb
@@ -39,6 +39,8 @@ class Diff::LCS::Change
[@action, @position, @element]
end
+ alias to_ary to_a
+
def self.from_a(arr)
arr = arr.flatten(1)
case arr.size
@@ -125,6 +127,8 @@ class Diff::LCS::ContextChange < Diff::LCS::Change
]
end
+ alias to_ary to_a
+
def self.from_a(arr)
Diff::LCS::Change.from_a(arr)
end