diff-lcs 1.6.2 → 2.0.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,109 +2,98 @@
2
2
 
3
3
  require "diff/lcs/change"
4
4
 
5
- module Diff::LCS
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)
14
- class DefaultCallbacks
15
- class << self
16
- # Called when two items match.
17
- def match(event)
18
- event
19
- end
5
+ # This callback object implements the default set of callback events, which only returns
6
+ # the event itself.
7
+ #
8
+ # ```ruby
9
+ # Diff::LCS.lcs(seq1, seq2, Diff::LCS::DefaultCallbacks)
10
+ # ```
11
+ class Diff::LCS::DefaultCallbacks
12
+ # Called when two items match.
13
+ def self.match(event) = event
20
14
 
21
- # Called when the old value is discarded in favour of the new value.
22
- def discard_a(event)
23
- event
24
- end
15
+ # Called when the old value is discarded in favour of the new value.
16
+ def self.discard_a(event) = event
25
17
 
26
- # Called when the new value is discarded in favour of the old value.
27
- def discard_b(event)
28
- event
29
- end
18
+ # Called when the new value is discarded in favour of the old value.
19
+ def self.discard_b(event) = event
30
20
 
31
- # Called when both the old and new values have changed.
32
- def change(event)
33
- event
34
- end
21
+ # Called when both the old and new values have changed.
22
+ def self.change(event) = event
35
23
 
36
- private :new
37
- end
38
- end
39
-
40
- # An alias for DefaultCallbacks that is used in
41
- # Diff::LCS#traverse_sequences.
42
- #
43
- # Diff::LCS.LCS(seq1, seq2, Diff::LCS::SequenceCallbacks)
44
- SequenceCallbacks = DefaultCallbacks
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)
50
- BalancedCallbacks = DefaultCallbacks
24
+ def self.new = self
51
25
 
52
- def self.callbacks_for(callbacks)
53
- callbacks.new
54
- rescue
55
- callbacks
26
+ class << self
27
+ private :new
56
28
  end
57
29
  end
58
30
 
59
- # This will produce a compound array of simple diff change objects. Each
60
- # element in the #diffs array is a +hunk+ or +hunk+ array, where each
61
- # element in each +hunk+ array is a single Change object representing the
62
- # addition or removal of a single element from one of the two tested
63
- # sequences. The +hunk+ provides the full context for the changes.
64
- #
65
- # diffs = Diff::LCS.diff(seq1, seq2)
66
- # # This example shows a simplified array format.
67
- # # [ [ [ '-', 0, 'a' ] ], # 1
68
- # # [ [ '+', 2, 'd' ] ], # 2
69
- # # [ [ '-', 4, 'h' ], # 3
70
- # # [ '+', 4, 'f' ] ],
71
- # # [ [ '+', 6, 'k' ] ], # 4
72
- # # [ [ '-', 8, 'n' ], # 5
73
- # # [ '-', 9, 'p' ],
74
- # # [ '+', 9, 'r' ],
75
- # # [ '+', 10, 's' ],
76
- # # [ '+', 11, 't' ] ] ]
77
- #
78
- # There are five hunks here. The first hunk says that the +a+ at position 0
79
- # of the first sequence should be deleted (<tt>'-'</tt>). The second hunk
80
- # says that the +d+ at position 2 of the second sequence should be inserted
81
- # (<tt>'+'</tt>). The third hunk says that the +h+ at position 4 of the
82
- # first sequence should be removed and replaced with the +f+ from position 4
83
- # of the second sequence. The other two hunks are described similarly.
84
- #
85
- # === Use
86
- #
87
- # This callback object must be initialised and is used by the Diff::LCS#diff
88
- # method.
89
- #
90
- # cbo = Diff::LCS::DiffCallbacks.new
91
- # Diff::LCS.LCS(seq1, seq2, cbo)
92
- # cbo.finish
93
- #
94
- # Note that the call to #finish is absolutely necessary, or the last set of
95
- # changes will not be visible. Alternatively, can be used as:
96
- #
97
- # cbo = Diff::LCS::DiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
98
- #
99
- # The necessary #finish call will be made.
100
- #
101
- # === Simplified Array Format
102
- #
103
- # The simplified array format used in the example above can be obtained
104
- # with:
105
- #
106
- # require 'pp'
107
- # pp diffs.map { |e| e.map { |f| f.to_a } }
31
+ # An alias for DefaultCallbacks used in Diff::LCS.traverse_sequences.
32
+ #
33
+ # ```ruby
34
+ # Diff::LCS.lcs(seq1, seq2, Diff::LCS::SequenceCallbacks)
35
+ # ```
36
+ Diff::LCS::SequenceCallbacks = Diff::LCS::DefaultCallbacks
37
+
38
+ # An alias for DefaultCallbacks used in Diff::LCS.traverse_balanced.
39
+ #
40
+ # ```ruby
41
+ # Diff::LCS.lcs(seq1, seq2, Diff::LCS::BalancedCallbacks)
42
+ # ```
43
+ Diff::LCS::BalancedCallbacks = Diff::LCS::DefaultCallbacks
44
+
45
+ # This will produce a compound array of simple diff change objects. Each element in the
46
+ # #diffs array is a `hunk` or `hunk` array, where each element in each `hunk` array is
47
+ # a single Change object representing the addition or removal of a single element from one
48
+ # of the two tested sequences. The `hunk` provides the full context for the changes.
49
+ #
50
+ # ```ruby
51
+ # diffs = Diff::LCS.diff(seq1, seq2)
52
+ # # This example shows a simplified array format.
53
+ # # [ [ [ '-', 0, 'a' ] ], # 1
54
+ # # [ [ '+', 2, 'd' ] ], # 2
55
+ # # [ [ '-', 4, 'h' ], # 3
56
+ # # [ '+', 4, 'f' ] ],
57
+ # # [ [ '+', 6, 'k' ] ], # 4
58
+ # # [ [ '-', 8, 'n' ], # 5
59
+ # # [ '-', 9, 'p' ],
60
+ # # [ '+', 9, 'r' ],
61
+ # # [ '+', 10, 's' ],
62
+ # # [ '+', 11, 't' ] ] ]
63
+ # ```
64
+ #
65
+ # There are five hunks here. The first hunk says that the `a` at position 0 of the first
66
+ # sequence should be deleted (`'-'`). The second hunk says that the `d` at position 2 of
67
+ # the second sequence should be inserted (`'+'`). The third hunk says that the `h` at
68
+ # position 4 of the first sequence should be removed and replaced with the `f` from
69
+ # position 4 of the second sequence. The other two hunks are described similarly.
70
+ #
71
+ # ### Use
72
+ #
73
+ # This callback object must be initialised and is used by the Diff::LCS#diff method.
74
+ #
75
+ # ```ruby
76
+ # cbo = Diff::LCS::DiffCallbacks.new
77
+ # Diff::LCS.lcs(seq1, seq2, cbo)
78
+ # cbo.finish
79
+ # ```
80
+ #
81
+ # Note that the call to #finish is absolutely necessary, or the last set of changes will
82
+ # not be visible. This callback also supports a block mode which automatically calls
83
+ # #finish.
84
+ #
85
+ # ```ruby
86
+ # result = Diff::LCS::DiffCallbacks.new { |cbo| Diff::LCS.lcs(seq1, seq2, cbo) }
87
+ # ```
88
+ #
89
+ # ### Simplified Array Format
90
+ #
91
+ # The simplified array format used in the example above can be obtained with:
92
+ #
93
+ # ```ruby
94
+ # require 'pp'
95
+ # pp diffs.map { |e| e.map { |f| f.to_a } }
96
+ # ```
108
97
  class Diff::LCS::DiffCallbacks
109
98
  # Returns the difference set collected during the diff process.
110
99
  attr_reader :diffs
@@ -122,15 +111,11 @@ class Diff::LCS::DiffCallbacks
122
111
  end
123
112
  end
124
113
 
125
- # Finalizes the diff process. If an unprocessed hunk still exists, then it
126
- # is appended to the diff list.
127
- def finish
128
- finish_hunk
129
- end
114
+ # Finalizes the diff process. If an unprocessed hunk still exists, then it is appended
115
+ # to the diff list.
116
+ def finish = finish_hunk
130
117
 
131
- def match(_event)
132
- finish_hunk
133
- end
118
+ def match(_event) = finish_hunk
134
119
 
135
120
  def discard_a(event)
136
121
  @hunk << Diff::LCS::Change.new("-", event.old_position, event.old_element)
@@ -147,81 +132,89 @@ class Diff::LCS::DiffCallbacks
147
132
  private :finish_hunk
148
133
  end
149
134
 
150
- # This will produce a compound array of contextual diff change objects. Each
151
- # element in the #diffs array is a "hunk" array, where each element in each
152
- # "hunk" array is a single change. Each change is a Diff::LCS::ContextChange
153
- # that contains both the old index and new index values for the change. The
154
- # "hunk" provides the full context for the changes. Both old and new objects
155
- # will be presented for changed objects. +nil+ will be substituted for a
156
- # discarded object.
157
- #
158
- # seq1 = %w(a b c e h j l m n p)
159
- # seq2 = %w(b c d e f j k l m r s t)
160
- #
161
- # diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)
162
- # # This example shows a simplified array format.
163
- # # [ [ [ '-', [ 0, 'a' ], [ 0, nil ] ] ], # 1
164
- # # [ [ '+', [ 3, nil ], [ 2, 'd' ] ] ], # 2
165
- # # [ [ '-', [ 4, 'h' ], [ 4, nil ] ], # 3
166
- # # [ '+', [ 5, nil ], [ 4, 'f' ] ] ],
167
- # # [ [ '+', [ 6, nil ], [ 6, 'k' ] ] ], # 4
168
- # # [ [ '-', [ 8, 'n' ], [ 9, nil ] ], # 5
169
- # # [ '+', [ 9, nil ], [ 9, 'r' ] ],
170
- # # [ '-', [ 9, 'p' ], [ 10, nil ] ],
171
- # # [ '+', [ 10, nil ], [ 10, 's' ] ],
172
- # # [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]
173
- #
174
- # The five hunks shown are comprised of individual changes; if there is a
175
- # related set of changes, they are still shown individually.
176
- #
177
- # This callback can also be used with Diff::LCS#sdiff, which will produce
178
- # results like:
179
- #
180
- # diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)
181
- # # This example shows a simplified array format.
182
- # # [ [ [ "-", [ 0, "a" ], [ 0, nil ] ] ], # 1
183
- # # [ [ "+", [ 3, nil ], [ 2, "d" ] ] ], # 2
184
- # # [ [ "!", [ 4, "h" ], [ 4, "f" ] ] ], # 3
185
- # # [ [ "+", [ 6, nil ], [ 6, "k" ] ] ], # 4
186
- # # [ [ "!", [ 8, "n" ], [ 9, "r" ] ], # 5
187
- # # [ "!", [ 9, "p" ], [ 10, "s" ] ],
188
- # # [ "+", [ 10, nil ], [ 11, "t" ] ] ] ]
189
- #
190
- # The five hunks are still present, but are significantly shorter in total
191
- # presentation, because changed items are shown as changes ("!") instead of
192
- # potentially "mismatched" pairs of additions and deletions.
193
- #
194
- # The result of this operation is similar to that of
195
- # Diff::LCS::SDiffCallbacks. They may be compared as:
196
- #
197
- # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
198
- # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
199
- #
200
- # s == c # -> true
201
- #
202
- # === Use
203
- #
204
- # This callback object must be initialised and can be used by the
205
- # Diff::LCS#diff or Diff::LCS#sdiff methods.
206
- #
207
- # cbo = Diff::LCS::ContextDiffCallbacks.new
208
- # Diff::LCS.LCS(seq1, seq2, cbo)
209
- # cbo.finish
210
- #
211
- # Note that the call to #finish is absolutely necessary, or the last set of
212
- # changes will not be visible. Alternatively, can be used as:
213
- #
214
- # cbo = Diff::LCS::ContextDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
215
- #
216
- # The necessary #finish call will be made.
217
- #
218
- # === Simplified Array Format
219
- #
220
- # The simplified array format used in the example above can be obtained
221
- # with:
222
- #
223
- # require 'pp'
224
- # pp diffs.map { |e| e.map { |f| f.to_a } }
135
+ # This will produce a compound array of contextual diff change objects. Each element in
136
+ # the #diffs array is a "hunk" array, where each element in each "hunk" array is a single
137
+ # change. Each change is a Diff::LCS::ContextChange that contains both the old index and
138
+ # new index values for the change. The "hunk" provides the full context for the changes.
139
+ # Both old and new objects will be presented for changed objects. `nil` will be
140
+ # substituted for a discarded object.
141
+ #
142
+ # ```ruby
143
+ # seq1 = %w(a b c e h j l m n p)
144
+ # seq2 = %w(b c d e f j k l m r s t)
145
+ #
146
+ # diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)
147
+ # # This example shows a simplified array format.
148
+ # # [ [ [ '-', [ 0, 'a' ], [ 0, nil ] ] ], # 1
149
+ # # [ [ '+', [ 3, nil ], [ 2, 'd' ] ] ], # 2
150
+ # # [ [ '-', [ 4, 'h' ], [ 4, nil ] ], # 3
151
+ # # [ '+', [ 5, nil ], [ 4, 'f' ] ] ],
152
+ # # [ [ '+', [ 6, nil ], [ 6, 'k' ] ] ], # 4
153
+ # # [ [ '-', [ 8, 'n' ], [ 9, nil ] ], # 5
154
+ # # [ '+', [ 9, nil ], [ 9, 'r' ] ],
155
+ # # [ '-', [ 9, 'p' ], [ 10, nil ] ],
156
+ # # [ '+', [ 10, nil ], [ 10, 's' ] ],
157
+ # # [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]
158
+ # ```
159
+ #
160
+ # The five hunks shown are comprised of individual changes; if there is a related set of
161
+ # changes, they are still shown individually.
162
+ #
163
+ # This callback can also be used with Diff::LCS#sdiff, which will produce results like:
164
+ #
165
+ # ```ruby
166
+ # diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)
167
+ # # This example shows a simplified array format.
168
+ # # [ [ [ "-", [ 0, "a" ], [ 0, nil ] ] ], # 1
169
+ # # [ [ "+", [ 3, nil ], [ 2, "d" ] ] ], # 2
170
+ # # [ [ "!", [ 4, "h" ], [ 4, "f" ] ] ], # 3
171
+ # # [ [ "+", [ 6, nil ], [ 6, "k" ] ] ], # 4
172
+ # # [ [ "!", [ 8, "n" ], [ 9, "r" ] ], # 5
173
+ # # [ "!", [ 9, "p" ], [ 10, "s" ] ],
174
+ # # [ "+", [ 10, nil ], [ 11, "t" ] ] ] ]
175
+ # ```
176
+ #
177
+ # The five hunks are still present, but are significantly shorter in total presentation,
178
+ # because changed items are shown as changes ("!") instead of potentially "mismatched"
179
+ # pairs of additions and deletions.
180
+ #
181
+ # The result of this operation is similar to that of Diff::LCS::SDiffCallbacks. They may
182
+ # be compared as:
183
+ #
184
+ # ```ruby
185
+ # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
186
+ # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
187
+ #
188
+ # s == c # => true
189
+ # ```
190
+ #
191
+ # ### Use
192
+ #
193
+ # This callback object must be initialised and can be used by the Diff::LCS#diff or
194
+ # Diff::LCS#sdiff methods.
195
+ #
196
+ # ```ruby
197
+ # cbo = Diff::LCS::ContextDiffCallbacks.new
198
+ # Diff::LCS.lcs(seq1, seq2, cbo)
199
+ # cbo.finish
200
+ # ```
201
+ #
202
+ # Note that the call to #finish is absolutely necessary, or the last set of changes will
203
+ # not be visible. This callback also supports a block mode which automatically calls
204
+ # #finish.
205
+ #
206
+ # ```ruby
207
+ # result = Diff::LCS::ContextDiffCallbacks.new { |cbo| Diff::LCS.lcs(seq1, seq2, cbo) }
208
+ # ```
209
+ #
210
+ # ### Simplified Array Format
211
+ #
212
+ # The simplified array format used in the example above can be obtained with:
213
+ #
214
+ # ```ruby
215
+ # require 'pp'
216
+ # pp diffs.map { |e| e.map { |f| f.to_a } }
217
+ # ```
225
218
  class Diff::LCS::ContextDiffCallbacks < Diff::LCS::DiffCallbacks
226
219
  def discard_a(event)
227
220
  @hunk << Diff::LCS::ContextChange.simplify(event)
@@ -236,70 +229,75 @@ class Diff::LCS::ContextDiffCallbacks < Diff::LCS::DiffCallbacks
236
229
  end
237
230
  end
238
231
 
239
- # This will produce a simple array of diff change objects. Each element in
240
- # the #diffs array is a single ContextChange. In the set of #diffs provided
241
- # by SDiffCallbacks, both old and new objects will be presented for both
242
- # changed <strong>and unchanged</strong> objects. +nil+ will be substituted
243
- # for a discarded object.
244
- #
245
- # The diffset produced by this callback, when provided to Diff::LCS#sdiff,
246
- # will compute and display the necessary components to show two sequences
247
- # and their minimized differences side by side, just like the Unix utility
248
- # +sdiff+.
249
- #
250
- # same same
251
- # before | after
252
- # old < -
253
- # - > new
254
- #
255
- # seq1 = %w(a b c e h j l m n p)
256
- # seq2 = %w(b c d e f j k l m r s t)
257
- #
258
- # diffs = Diff::LCS.sdiff(seq1, seq2)
259
- # # This example shows a simplified array format.
260
- # # [ [ "-", [ 0, "a"], [ 0, nil ] ],
261
- # # [ "=", [ 1, "b"], [ 0, "b" ] ],
262
- # # [ "=", [ 2, "c"], [ 1, "c" ] ],
263
- # # [ "+", [ 3, nil], [ 2, "d" ] ],
264
- # # [ "=", [ 3, "e"], [ 3, "e" ] ],
265
- # # [ "!", [ 4, "h"], [ 4, "f" ] ],
266
- # # [ "=", [ 5, "j"], [ 5, "j" ] ],
267
- # # [ "+", [ 6, nil], [ 6, "k" ] ],
268
- # # [ "=", [ 6, "l"], [ 7, "l" ] ],
269
- # # [ "=", [ 7, "m"], [ 8, "m" ] ],
270
- # # [ "!", [ 8, "n"], [ 9, "r" ] ],
271
- # # [ "!", [ 9, "p"], [ 10, "s" ] ],
272
- # # [ "+", [ 10, nil], [ 11, "t" ] ] ]
273
- #
274
- # The result of this operation is similar to that of
275
- # Diff::LCS::ContextDiffCallbacks. They may be compared as:
276
- #
277
- # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
278
- # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
279
- #
280
- # s == c # -> true
281
- #
282
- # === Use
283
- #
284
- # This callback object must be initialised and is used by the Diff::LCS#sdiff
285
- # method.
286
- #
287
- # cbo = Diff::LCS::SDiffCallbacks.new
288
- # Diff::LCS.LCS(seq1, seq2, cbo)
289
- #
290
- # As with the other initialisable callback objects,
291
- # Diff::LCS::SDiffCallbacks can be initialised with a block. As there is no
292
- # "fininishing" to be done, this has no effect on the state of the object.
293
- #
294
- # cbo = Diff::LCS::SDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
295
- #
296
- # === Simplified Array Format
297
- #
298
- # The simplified array format used in the example above can be obtained
299
- # with:
300
- #
301
- # require 'pp'
302
- # pp diffs.map { |e| e.to_a }
232
+ # This will produce a simple array of diff change objects. Each element in the #diffs
233
+ # array is a single ContextChange. In the set of #diffs provided by SDiffCallbacks, both
234
+ # old and new objects will be presented for both changed <strong>and unchanged</strong>
235
+ # objects. `nil` will be substituted for a discarded object.
236
+ #
237
+ # The diffset produced by this callback, when provided to Diff::LCS#sdiff, will compute
238
+ # and display the necessary components to show two sequences and their minimized
239
+ # differences side by side, just like the Unix utility `sdiff`.
240
+ #
241
+ # ```ruby
242
+ # # same same
243
+ # # before | after
244
+ # # old < -
245
+ # # - > new
246
+ #
247
+ # seq1 = %w(a b c e h j l m n p)
248
+ # seq2 = %w(b c d e f j k l m r s t)
249
+ #
250
+ # diffs = Diff::LCS.sdiff(seq1, seq2)
251
+ # # This example shows a simplified array format.
252
+ # # [ [ "-", [ 0, "a"], [ 0, nil ] ],
253
+ # # [ "=", [ 1, "b"], [ 0, "b" ] ],
254
+ # # [ "=", [ 2, "c"], [ 1, "c" ] ],
255
+ # # [ "+", [ 3, nil], [ 2, "d" ] ],
256
+ # # [ "=", [ 3, "e"], [ 3, "e" ] ],
257
+ # # [ "!", [ 4, "h"], [ 4, "f" ] ],
258
+ # # [ "=", [ 5, "j"], [ 5, "j" ] ],
259
+ # # [ "+", [ 6, nil], [ 6, "k" ] ],
260
+ # # [ "=", [ 6, "l"], [ 7, "l" ] ],
261
+ # # [ "=", [ 7, "m"], [ 8, "m" ] ],
262
+ # # [ "!", [ 8, "n"], [ 9, "r" ] ],
263
+ # # [ "!", [ 9, "p"], [ 10, "s" ] ],
264
+ # # [ "+", [ 10, nil], [ 11, "t" ] ] ]
265
+ # ```
266
+ #
267
+ # The result of this operation is similar to that of Diff::LCS::ContextDiffCallbacks. They
268
+ # may be compared as:
269
+ #
270
+ # ```ruby
271
+ # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
272
+ # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
273
+ #
274
+ # s == c # => true
275
+ # ```
276
+ #
277
+ # ### Use
278
+ #
279
+ # This callback object must be initialised and is used by the Diff::LCS#sdiff method.
280
+ #
281
+ # ```ruby
282
+ # cbo = Diff::LCS::SDiffCallbacks.new
283
+ # Diff::LCS.lcs(seq1, seq2, cbo)
284
+ # ```
285
+ #
286
+ # This callback also supports initialization with a block, but as there is no "finishing"
287
+ # to be done, this has no effect on the state of the object.
288
+ #
289
+ # ```ruby
290
+ # result = Diff::LCS::SDiffCallbacks.new { |cbo| Diff::LCS.lcs(seq1, seq2, cbo) }
291
+ # ```
292
+ #
293
+ # ### Simplified Array Format
294
+ #
295
+ # The simplified array format used in the example above can be obtained with:
296
+ #
297
+ # ```ruby
298
+ # require 'pp'
299
+ # pp diffs.map { |e| e.to_a }
300
+ # ```
303
301
  class Diff::LCS::SDiffCallbacks
304
302
  # Returns the difference set collected during the diff process.
305
303
  attr_reader :diffs