diff-lcs 1.1.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -0
- data/Code-of-Conduct.md +74 -0
- data/Contributing.md +119 -0
- data/History.md +400 -0
- data/{License.rdoc → License.md} +6 -5
- data/Manifest.txt +36 -4
- data/README.rdoc +35 -23
- data/Rakefile +106 -11
- data/bin/htmldiff +7 -4
- data/bin/ldiff +4 -1
- data/docs/COPYING.txt +21 -22
- data/docs/artistic.txt +127 -0
- data/lib/diff/lcs/array.rb +1 -15
- data/lib/diff/lcs/backports.rb +9 -0
- data/lib/diff/lcs/block.rb +4 -18
- data/lib/diff/lcs/callbacks.rb +233 -230
- data/lib/diff/lcs/change.rb +114 -109
- data/lib/diff/lcs/htmldiff.rb +17 -18
- data/lib/diff/lcs/hunk.rb +232 -116
- data/lib/diff/lcs/internals.rb +308 -0
- data/lib/diff/lcs/ldiff.rb +138 -177
- data/lib/diff/lcs/string.rb +1 -15
- data/lib/diff/lcs.rb +597 -963
- data/lib/diff-lcs.rb +1 -3
- data/spec/change_spec.rb +89 -0
- data/spec/diff_spec.rb +32 -16
- data/spec/fixtures/aX +1 -0
- data/spec/fixtures/bXaX +1 -0
- data/spec/fixtures/ds1.csv +50 -0
- data/spec/fixtures/ds2.csv +51 -0
- data/spec/fixtures/ldiff/output.diff +4 -0
- data/spec/fixtures/ldiff/output.diff-c +7 -0
- data/spec/fixtures/ldiff/output.diff-e +3 -0
- data/spec/fixtures/ldiff/output.diff-f +3 -0
- data/spec/fixtures/ldiff/output.diff-u +5 -0
- data/spec/fixtures/ldiff/output.diff.chef +4 -0
- data/spec/fixtures/ldiff/output.diff.chef-c +15 -0
- data/spec/fixtures/ldiff/output.diff.chef-e +3 -0
- data/spec/fixtures/ldiff/output.diff.chef-f +3 -0
- data/spec/fixtures/ldiff/output.diff.chef-u +9 -0
- data/spec/fixtures/ldiff/output.diff.chef2 +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-c +20 -0
- data/spec/fixtures/ldiff/output.diff.chef2-d +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-e +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-f +7 -0
- data/spec/fixtures/ldiff/output.diff.chef2-u +16 -0
- data/spec/fixtures/new-chef +4 -0
- data/spec/fixtures/new-chef2 +17 -0
- data/spec/fixtures/old-chef +4 -0
- data/spec/fixtures/old-chef2 +14 -0
- data/spec/hunk_spec.rb +83 -0
- data/spec/issues_spec.rb +154 -0
- data/spec/lcs_spec.rb +36 -16
- data/spec/ldiff_spec.rb +87 -0
- data/spec/patch_spec.rb +198 -172
- data/spec/sdiff_spec.rb +99 -89
- data/spec/spec_helper.rb +149 -59
- data/spec/traverse_balanced_spec.rb +191 -167
- data/spec/traverse_sequences_spec.rb +105 -51
- metadata +218 -99
- data/.gemtest +0 -0
- data/History.rdoc +0 -54
- data/diff-lcs.gemspec +0 -51
- data/docs/artistic.html +0 -289
data/lib/diff/lcs/callbacks.rb
CHANGED
@@ -1,44 +1,34 @@
|
|
1
|
-
|
2
|
-
#--
|
3
|
-
# Copyright 2004 Austin Ziegler <diff-lcs@halostatue.ca>
|
4
|
-
# adapted from:
|
5
|
-
# Algorithm::Diff (Perl) by Ned Konz <perl@bike-nomad.com>
|
6
|
-
# Smalltalk by Mario I. Wolczko <mario@wolczko.com>
|
7
|
-
# implements McIlroy-Hunt diff algorithm
|
8
|
-
#
|
9
|
-
# This program is free software. It may be redistributed and/or modified under
|
10
|
-
# the terms of the GPL version 2 (or later), the Perl Artistic licence, or the
|
11
|
-
# Ruby licence.
|
12
|
-
#
|
13
|
-
# $Id$
|
14
|
-
#++
|
15
|
-
# Contains definitions for all default callback objects.
|
1
|
+
# frozen_string_literal: true
|
16
2
|
|
17
3
|
require 'diff/lcs/change'
|
18
4
|
|
19
|
-
module Diff::LCS
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
5
|
+
module Diff::LCS # rubocop:disable Style/Documentation
|
6
|
+
# This callback object implements the default set of callback events,
|
7
|
+
# which only returns the event itself. Note that #finished_a and
|
8
|
+
# #finished_b are not implemented -- I haven't yet figured out where they
|
9
|
+
# would be useful.
|
10
|
+
#
|
11
|
+
# Note that this is intended to be called as is, e.g.,
|
12
|
+
#
|
13
|
+
# Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
|
27
14
|
class DefaultCallbacks
|
28
15
|
class << self
|
29
|
-
|
16
|
+
# Called when two items match.
|
30
17
|
def match(event)
|
31
18
|
event
|
32
19
|
end
|
33
|
-
|
20
|
+
|
21
|
+
# Called when the old value is discarded in favour of the new value.
|
34
22
|
def discard_a(event)
|
35
23
|
event
|
36
24
|
end
|
37
|
-
|
25
|
+
|
26
|
+
# Called when the new value is discarded in favour of the old value.
|
38
27
|
def discard_b(event)
|
39
28
|
event
|
40
29
|
end
|
41
|
-
|
30
|
+
|
31
|
+
# Called when both the old and new values have changed.
|
42
32
|
def change(event)
|
43
33
|
event
|
44
34
|
end
|
@@ -47,88 +37,97 @@ module Diff::LCS
|
|
47
37
|
end
|
48
38
|
end
|
49
39
|
|
50
|
-
|
51
|
-
|
52
|
-
|
40
|
+
# An alias for DefaultCallbacks that is used in
|
41
|
+
# Diff::LCS#traverse_sequences.
|
42
|
+
#
|
43
|
+
# Diff::LCS.LCS(seq1, seq2, Diff::LCS::SequenceCallbacks)
|
53
44
|
SequenceCallbacks = DefaultCallbacks
|
54
|
-
|
55
|
-
|
56
|
-
|
45
|
+
|
46
|
+
# An alias for DefaultCallbacks that is used in
|
47
|
+
# Diff::LCS#traverse_balanced.
|
48
|
+
#
|
49
|
+
# Diff::LCS.LCS(seq1, seq2, Diff::LCS::BalancedCallbacks)
|
57
50
|
BalancedCallbacks = DefaultCallbacks
|
51
|
+
|
52
|
+
def self.callbacks_for(callbacks)
|
53
|
+
callbacks.new rescue callbacks
|
54
|
+
end
|
58
55
|
end
|
59
56
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
57
|
+
# This will produce a compound array of simple diff change objects. Each
|
58
|
+
# element in the #diffs array is a +hunk+ or +hunk+ array, where each
|
59
|
+
# element in each +hunk+ array is a single Change object representing the
|
60
|
+
# addition or removal of a single element from one of the two tested
|
61
|
+
# sequences. The +hunk+ provides the full context for the changes.
|
62
|
+
#
|
63
|
+
# diffs = Diff::LCS.diff(seq1, seq2)
|
64
|
+
# # This example shows a simplified array format.
|
65
|
+
# # [ [ [ '-', 0, 'a' ] ], # 1
|
66
|
+
# # [ [ '+', 2, 'd' ] ], # 2
|
67
|
+
# # [ [ '-', 4, 'h' ], # 3
|
68
|
+
# # [ '+', 4, 'f' ] ],
|
69
|
+
# # [ [ '+', 6, 'k' ] ], # 4
|
70
|
+
# # [ [ '-', 8, 'n' ], # 5
|
71
|
+
# # [ '-', 9, 'p' ],
|
72
|
+
# # [ '+', 9, 'r' ],
|
73
|
+
# # [ '+', 10, 's' ],
|
74
|
+
# # [ '+', 11, 't' ] ] ]
|
75
|
+
#
|
76
|
+
# There are five hunks here. The first hunk says that the +a+ at position 0
|
77
|
+
# of the first sequence should be deleted (<tt>'-'</tt>). The second hunk
|
78
|
+
# says that the +d+ at position 2 of the second sequence should be inserted
|
79
|
+
# (<tt>'+'</tt>). The third hunk says that the +h+ at position 4 of the
|
80
|
+
# first sequence should be removed and replaced with the +f+ from position 4
|
81
|
+
# of the second sequence. The other two hunks are described similarly.
|
82
|
+
#
|
83
|
+
# === Use
|
84
|
+
#
|
85
|
+
# This callback object must be initialised and is used by the Diff::LCS#diff
|
86
|
+
# method.
|
87
|
+
#
|
88
|
+
# cbo = Diff::LCS::DiffCallbacks.new
|
89
|
+
# Diff::LCS.LCS(seq1, seq2, cbo)
|
90
|
+
# cbo.finish
|
91
|
+
#
|
92
|
+
# Note that the call to #finish is absolutely necessary, or the last set of
|
93
|
+
# changes will not be visible. Alternatively, can be used as:
|
94
|
+
#
|
95
|
+
# cbo = Diff::LCS::DiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
|
96
|
+
#
|
97
|
+
# The necessary #finish call will be made.
|
98
|
+
#
|
99
|
+
# === Simplified Array Format
|
100
|
+
#
|
101
|
+
# The simplified array format used in the example above can be obtained
|
102
|
+
# with:
|
103
|
+
#
|
104
|
+
# require 'pp'
|
105
|
+
# pp diffs.map { |e| e.map { |f| f.to_a } }
|
107
106
|
class Diff::LCS::DiffCallbacks
|
108
|
-
|
107
|
+
# Returns the difference set collected during the diff process.
|
109
108
|
attr_reader :diffs
|
110
109
|
|
111
110
|
def initialize # :yields self:
|
112
111
|
@hunk = []
|
113
112
|
@diffs = []
|
114
113
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
114
|
+
return unless block_given?
|
115
|
+
|
116
|
+
begin
|
117
|
+
yield self
|
118
|
+
ensure
|
119
|
+
finish
|
121
120
|
end
|
122
121
|
end
|
123
122
|
|
124
|
-
|
125
|
-
|
123
|
+
# Finalizes the diff process. If an unprocessed hunk still exists, then it
|
124
|
+
# is appended to the diff list.
|
126
125
|
def finish
|
127
|
-
|
126
|
+
finish_hunk
|
128
127
|
end
|
129
128
|
|
130
|
-
def match(
|
131
|
-
|
129
|
+
def match(_event)
|
130
|
+
finish_hunk
|
132
131
|
end
|
133
132
|
|
134
133
|
def discard_a(event)
|
@@ -139,86 +138,88 @@ class Diff::LCS::DiffCallbacks
|
|
139
138
|
@hunk << Diff::LCS::Change.new('+', event.new_position, event.new_element)
|
140
139
|
end
|
141
140
|
|
142
|
-
|
143
|
-
def add_nonempty_hunk
|
141
|
+
def finish_hunk
|
144
142
|
@diffs << @hunk unless @hunk.empty?
|
145
143
|
@hunk = []
|
146
144
|
end
|
145
|
+
private :finish_hunk
|
147
146
|
end
|
148
147
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
148
|
+
# This will produce a compound array of contextual diff change objects. Each
|
149
|
+
# element in the #diffs array is a "hunk" array, where each element in each
|
150
|
+
# "hunk" array is a single change. Each change is a Diff::LCS::ContextChange
|
151
|
+
# that contains both the old index and new index values for the change. The
|
152
|
+
# "hunk" provides the full context for the changes. Both old and new objects
|
153
|
+
# will be presented for changed objects. +nil+ will be substituted for a
|
154
|
+
# discarded object.
|
155
|
+
#
|
156
|
+
# seq1 = %w(a b c e h j l m n p)
|
157
|
+
# seq2 = %w(b c d e f j k l m r s t)
|
158
|
+
#
|
159
|
+
# diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)
|
160
|
+
# # This example shows a simplified array format.
|
161
|
+
# # [ [ [ '-', [ 0, 'a' ], [ 0, nil ] ] ], # 1
|
162
|
+
# # [ [ '+', [ 3, nil ], [ 2, 'd' ] ] ], # 2
|
163
|
+
# # [ [ '-', [ 4, 'h' ], [ 4, nil ] ], # 3
|
164
|
+
# # [ '+', [ 5, nil ], [ 4, 'f' ] ] ],
|
165
|
+
# # [ [ '+', [ 6, nil ], [ 6, 'k' ] ] ], # 4
|
166
|
+
# # [ [ '-', [ 8, 'n' ], [ 9, nil ] ], # 5
|
167
|
+
# # [ '+', [ 9, nil ], [ 9, 'r' ] ],
|
168
|
+
# # [ '-', [ 9, 'p' ], [ 10, nil ] ],
|
169
|
+
# # [ '+', [ 10, nil ], [ 10, 's' ] ],
|
170
|
+
# # [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]
|
171
|
+
#
|
172
|
+
# The five hunks shown are comprised of individual changes; if there is a
|
173
|
+
# related set of changes, they are still shown individually.
|
174
|
+
#
|
175
|
+
# This callback can also be used with Diff::LCS#sdiff, which will produce
|
176
|
+
# results like:
|
177
|
+
#
|
178
|
+
# diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)
|
179
|
+
# # This example shows a simplified array format.
|
180
|
+
# # [ [ [ "-", [ 0, "a" ], [ 0, nil ] ] ], # 1
|
181
|
+
# # [ [ "+", [ 3, nil ], [ 2, "d" ] ] ], # 2
|
182
|
+
# # [ [ "!", [ 4, "h" ], [ 4, "f" ] ] ], # 3
|
183
|
+
# # [ [ "+", [ 6, nil ], [ 6, "k" ] ] ], # 4
|
184
|
+
# # [ [ "!", [ 8, "n" ], [ 9, "r" ] ], # 5
|
185
|
+
# # [ "!", [ 9, "p" ], [ 10, "s" ] ],
|
186
|
+
# # [ "+", [ 10, nil ], [ 11, "t" ] ] ] ]
|
187
|
+
#
|
188
|
+
# The five hunks are still present, but are significantly shorter in total
|
189
|
+
# presentation, because changed items are shown as changes ("!") instead of
|
190
|
+
# potentially "mismatched" pairs of additions and deletions.
|
191
|
+
#
|
192
|
+
# The result of this operation is similar to that of
|
193
|
+
# Diff::LCS::SDiffCallbacks. They may be compared as:
|
194
|
+
#
|
195
|
+
# s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
|
196
|
+
# c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
|
197
|
+
#
|
198
|
+
# s == c # -> true
|
199
|
+
#
|
200
|
+
# === Use
|
201
|
+
#
|
202
|
+
# This callback object must be initialised and can be used by the
|
203
|
+
# Diff::LCS#diff or Diff::LCS#sdiff methods.
|
204
|
+
#
|
205
|
+
# cbo = Diff::LCS::ContextDiffCallbacks.new
|
206
|
+
# Diff::LCS.LCS(seq1, seq2, cbo)
|
207
|
+
# cbo.finish
|
208
|
+
#
|
209
|
+
# Note that the call to #finish is absolutely necessary, or the last set of
|
210
|
+
# changes will not be visible. Alternatively, can be used as:
|
211
|
+
#
|
212
|
+
# cbo = Diff::LCS::ContextDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
|
213
|
+
#
|
214
|
+
# The necessary #finish call will be made.
|
215
|
+
#
|
216
|
+
# === Simplified Array Format
|
217
|
+
#
|
218
|
+
# The simplified array format used in the example above can be obtained
|
219
|
+
# with:
|
220
|
+
#
|
221
|
+
# require 'pp'
|
222
|
+
# pp diffs.map { |e| e.map { |f| f.to_a } }
|
222
223
|
class Diff::LCS::ContextDiffCallbacks < Diff::LCS::DiffCallbacks
|
223
224
|
def discard_a(event)
|
224
225
|
@hunk << Diff::LCS::ContextChange.simplify(event)
|
@@ -233,70 +234,72 @@ class Diff::LCS::ContextDiffCallbacks < Diff::LCS::DiffCallbacks
|
|
233
234
|
end
|
234
235
|
end
|
235
236
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
237
|
+
# This will produce a simple array of diff change objects. Each element in
|
238
|
+
# the #diffs array is a single ContextChange. In the set of #diffs provided
|
239
|
+
# by SDiffCallbacks, both old and new objects will be presented for both
|
240
|
+
# changed <strong>and unchanged</strong> objects. +nil+ will be substituted
|
241
|
+
# for a discarded object.
|
242
|
+
#
|
243
|
+
# The diffset produced by this callback, when provided to Diff::LCS#sdiff,
|
244
|
+
# will compute and display the necessary components to show two sequences
|
245
|
+
# and their minimized differences side by side, just like the Unix utility
|
246
|
+
# +sdiff+.
|
247
|
+
#
|
248
|
+
# same same
|
249
|
+
# before | after
|
250
|
+
# old < -
|
251
|
+
# - > new
|
252
|
+
#
|
253
|
+
# seq1 = %w(a b c e h j l m n p)
|
254
|
+
# seq2 = %w(b c d e f j k l m r s t)
|
255
|
+
#
|
256
|
+
# diffs = Diff::LCS.sdiff(seq1, seq2)
|
257
|
+
# # This example shows a simplified array format.
|
258
|
+
# # [ [ "-", [ 0, "a"], [ 0, nil ] ],
|
259
|
+
# # [ "=", [ 1, "b"], [ 0, "b" ] ],
|
260
|
+
# # [ "=", [ 2, "c"], [ 1, "c" ] ],
|
261
|
+
# # [ "+", [ 3, nil], [ 2, "d" ] ],
|
262
|
+
# # [ "=", [ 3, "e"], [ 3, "e" ] ],
|
263
|
+
# # [ "!", [ 4, "h"], [ 4, "f" ] ],
|
264
|
+
# # [ "=", [ 5, "j"], [ 5, "j" ] ],
|
265
|
+
# # [ "+", [ 6, nil], [ 6, "k" ] ],
|
266
|
+
# # [ "=", [ 6, "l"], [ 7, "l" ] ],
|
267
|
+
# # [ "=", [ 7, "m"], [ 8, "m" ] ],
|
268
|
+
# # [ "!", [ 8, "n"], [ 9, "r" ] ],
|
269
|
+
# # [ "!", [ 9, "p"], [ 10, "s" ] ],
|
270
|
+
# # [ "+", [ 10, nil], [ 11, "t" ] ] ]
|
271
|
+
#
|
272
|
+
# The result of this operation is similar to that of
|
273
|
+
# Diff::LCS::ContextDiffCallbacks. They may be compared as:
|
274
|
+
#
|
275
|
+
# s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
|
276
|
+
# c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
|
277
|
+
#
|
278
|
+
# s == c # -> true
|
279
|
+
#
|
280
|
+
# === Use
|
281
|
+
#
|
282
|
+
# This callback object must be initialised and is used by the Diff::LCS#sdiff
|
283
|
+
# method.
|
284
|
+
#
|
285
|
+
# cbo = Diff::LCS::SDiffCallbacks.new
|
286
|
+
# Diff::LCS.LCS(seq1, seq2, cbo)
|
287
|
+
#
|
288
|
+
# As with the other initialisable callback objects,
|
289
|
+
# Diff::LCS::SDiffCallbacks can be initialised with a block. As there is no
|
290
|
+
# "fininishing" to be done, this has no effect on the state of the object.
|
291
|
+
#
|
292
|
+
# cbo = Diff::LCS::SDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
|
293
|
+
#
|
294
|
+
# === Simplified Array Format
|
295
|
+
#
|
296
|
+
# The simplified array format used in the example above can be obtained
|
297
|
+
# with:
|
298
|
+
#
|
299
|
+
# require 'pp'
|
300
|
+
# pp diffs.map { |e| e.to_a }
|
298
301
|
class Diff::LCS::SDiffCallbacks
|
299
|
-
|
302
|
+
# Returns the difference set collected during the diff process.
|
300
303
|
attr_reader :diffs
|
301
304
|
|
302
305
|
def initialize #:yields self:
|