openfeature-sdk-sorbet 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -1
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -1
  5. data/CHANGELOG.md +12 -3
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +55 -49
  8. data/README.md +23 -6
  9. data/lib/open_feature/client.rb +90 -32
  10. data/lib/open_feature/client_metadata.rb +1 -0
  11. data/lib/open_feature/evaluation_context.rb +2 -2
  12. data/lib/open_feature/evaluation_details.rb +2 -2
  13. data/lib/open_feature/hook.rb +41 -1
  14. data/lib/open_feature/hook_context.rb +30 -0
  15. data/lib/open_feature/hooks.rb +22 -0
  16. data/lib/open_feature/multiple_source_provider.rb +28 -12
  17. data/lib/open_feature/no_op_provider.rb +2 -3
  18. data/lib/open_feature/provider.rb +16 -2
  19. data/lib/open_feature/provider_status.rb +13 -0
  20. data/lib/open_feature.rb +9 -2
  21. data/sorbet/rbi/gems/.gitattributes +1 -0
  22. data/sorbet/rbi/gems/{json@2.6.3.rbi → json@2.7.1.rbi} +80 -60
  23. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  24. data/sorbet/rbi/gems/{minitest@5.18.0.rbi → minitest@5.21.2.rbi} +299 -258
  25. data/sorbet/rbi/gems/{parallel@1.23.0.rbi → parallel@1.24.0.rbi} +8 -1
  26. data/sorbet/rbi/gems/{parser@3.2.2.1.rbi → parser@3.3.0.5.rbi} +438 -2219
  27. data/sorbet/rbi/gems/prism@0.19.0.rbi +25199 -0
  28. data/sorbet/rbi/gems/psych@5.1.2.rbi +1731 -0
  29. data/sorbet/rbi/gems/racc@1.7.3.rbi +157 -0
  30. data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.1.0.rbi} +68 -65
  31. data/sorbet/rbi/gems/{rbi@0.0.16.rbi → rbi@0.1.6.rbi} +628 -755
  32. data/sorbet/rbi/gems/{regexp_parser@2.8.0.rbi → regexp_parser@2.9.0.rbi} +203 -180
  33. data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.2.6.rbi} +116 -52
  34. data/sorbet/rbi/gems/{rubocop-ast@1.28.1.rbi → rubocop-ast@1.30.0.rbi} +178 -84
  35. data/sorbet/rbi/gems/{rubocop-minitest@0.31.0.rbi → rubocop-minitest@0.34.5.rbi} +280 -232
  36. data/sorbet/rbi/gems/{rubocop-performance@1.17.1.rbi → rubocop-performance@1.20.2.rbi} +397 -172
  37. data/sorbet/rbi/gems/{rubocop-sorbet@0.7.0.rbi → rubocop-sorbet@0.7.6.rbi} +728 -261
  38. data/sorbet/rbi/gems/{rubocop@1.51.0.rbi → rubocop@1.60.2.rbi} +4006 -1936
  39. data/sorbet/rbi/gems/spoom@1.2.1.rbi +17 -56
  40. data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
  41. data/sorbet/rbi/gems/{tapioca@0.11.6.rbi → tapioca@0.11.17.rbi} +778 -576
  42. data/sorbet/rbi/gems/{thor@1.2.2.rbi → thor@1.3.0.rbi} +775 -395
  43. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +1 -1
  44. data/sorbet/rbi/gems/yard@0.9.34.rbi +2 -2
  45. data/sorbet/rbi/gems/{zeitwerk@2.6.8.rbi → zeitwerk@2.6.12.rbi} +78 -67
  46. data/sorbet/tapioca/config.yml +2 -2
  47. data/sorbet/tapioca/require.rb +3 -1
  48. metadata +36 -31
  49. data/openfeature-sdk-sorbet.gemspec +0 -35
  50. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1083
  51. data/sorbet/rbi/gems/irb@1.6.4.rbi +0 -342
  52. data/sorbet/rbi/gems/unparser@0.6.7.rbi +0 -4524
  53. /data/sorbet/rbi/gems/{io-console@0.6.0.rbi → io-console@0.7.2.rbi} +0 -0
  54. /data/sorbet/rbi/gems/{reline@0.3.3.rbi → reline@0.4.2.rbi} +0 -0
  55. /data/sorbet/rbi/gems/{unicode-display_width@2.4.2.rbi → unicode-display_width@2.5.0.rbi} +0 -0
@@ -1,1083 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `diff-lcs` gem.
5
- # Please instead update this file by running `bin/tapioca gem diff-lcs`.
6
-
7
- # source://diff-lcs//lib/diff/lcs.rb#3
8
- module Diff; end
9
-
10
- # source://diff-lcs//lib/diff/lcs.rb#51
11
- module Diff::LCS
12
- # Returns the difference set between +self+ and +other+. See Diff::LCS#diff.
13
- #
14
- # source://diff-lcs//lib/diff/lcs.rb#75
15
- def diff(other, callbacks = T.unsafe(nil), &block); end
16
-
17
- # Returns an Array containing the longest common subsequence(s) between
18
- # +self+ and +other+. See Diff::LCS#lcs.
19
- #
20
- # lcs = seq1.lcs(seq2)
21
- #
22
- # A note when using objects: Diff::LCS only works properly when each object
23
- # can be used as a key in a Hash, which typically means that the objects must
24
- # implement Object#eql? in a way that two identical values compare
25
- # identically for key purposes. That is:
26
- #
27
- # O.new('a').eql?(O.new('a')) == true
28
- #
29
- # source://diff-lcs//lib/diff/lcs.rb#70
30
- def lcs(other, &block); end
31
-
32
- # Attempts to patch +self+ with the provided +patchset+. A new sequence based
33
- # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Attempts
34
- # to autodiscover the direction of the patch.
35
- #
36
- # source://diff-lcs//lib/diff/lcs.rb#101
37
- def patch(patchset); end
38
-
39
- # Attempts to patch +self+ with the provided +patchset+. A new sequence based
40
- # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Does no
41
- # patch direction autodiscovery.
42
- #
43
- # source://diff-lcs//lib/diff/lcs.rb#109
44
- def patch!(patchset); end
45
-
46
- # Attempts to patch +self+ with the provided +patchset+, using #patch!. If
47
- # the sequence this is used on supports #replace, the value of +self+ will be
48
- # replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.
49
- #
50
- # source://diff-lcs//lib/diff/lcs.rb#123
51
- def patch_me(patchset); end
52
-
53
- # Returns the balanced ("side-by-side") difference set between +self+ and
54
- # +other+. See Diff::LCS#sdiff.
55
- #
56
- # source://diff-lcs//lib/diff/lcs.rb#81
57
- def sdiff(other, callbacks = T.unsafe(nil), &block); end
58
-
59
- # Traverses the discovered longest common subsequences between +self+ and
60
- # +other+ using the alternate, balanced algorithm. See
61
- # Diff::LCS#traverse_balanced.
62
- #
63
- # source://diff-lcs//lib/diff/lcs.rb#94
64
- def traverse_balanced(other, callbacks = T.unsafe(nil), &block); end
65
-
66
- # Traverses the discovered longest common subsequences between +self+ and
67
- # +other+. See Diff::LCS#traverse_sequences.
68
- #
69
- # source://diff-lcs//lib/diff/lcs.rb#87
70
- def traverse_sequences(other, callbacks = T.unsafe(nil), &block); end
71
-
72
- # Attempts to patch +self+ with the provided +patchset+. A new sequence based
73
- # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Attempts
74
- # to autodiscover the direction of the patch.
75
- #
76
- # source://diff-lcs//lib/diff/lcs.rb#101
77
- def unpatch(patchset); end
78
-
79
- # Attempts to unpatch +self+ with the provided +patchset+. A new sequence
80
- # based on +self+ and the +patchset+ will be created. See Diff::LCS#unpatch.
81
- # Does no patch direction autodiscovery.
82
- #
83
- # source://diff-lcs//lib/diff/lcs.rb#116
84
- def unpatch!(patchset); end
85
-
86
- # Attempts to unpatch +self+ with the provided +patchset+, using #unpatch!.
87
- # If the sequence this is used on supports #replace, the value of +self+ will
88
- # be replaced. See Diff::LCS#unpatch. Does no patch direction autodiscovery.
89
- #
90
- # source://diff-lcs//lib/diff/lcs.rb#134
91
- def unpatch_me(patchset); end
92
-
93
- class << self
94
- # :yields seq1[i] for each matched:
95
- #
96
- # source://diff-lcs//lib/diff/lcs.rb#144
97
- def LCS(seq1, seq2, &block); end
98
-
99
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#52
100
- def callbacks_for(callbacks); end
101
-
102
- # #diff computes the smallest set of additions and deletions necessary to
103
- # turn the first sequence into the second, and returns a description of these
104
- # changes.
105
- #
106
- # See Diff::LCS::DiffCallbacks for the default behaviour. An alternate
107
- # behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
108
- # Class argument is provided for +callbacks+, #diff will attempt to
109
- # initialise it. If the +callbacks+ object (possibly initialised) responds to
110
- # #finish, it will be called.
111
- #
112
- # source://diff-lcs//lib/diff/lcs.rb#168
113
- def diff(seq1, seq2, callbacks = T.unsafe(nil), &block); end
114
-
115
- # :yields seq1[i] for each matched:
116
- #
117
- # source://diff-lcs//lib/diff/lcs.rb#144
118
- def lcs(seq1, seq2, &block); end
119
-
120
- # Applies a +patchset+ to the sequence +src+ according to the +direction+
121
- # (<tt>:patch</tt> or <tt>:unpatch</tt>), producing a new sequence.
122
- #
123
- # If the +direction+ is not specified, Diff::LCS::patch will attempt to
124
- # discover the direction of the +patchset+.
125
- #
126
- # A +patchset+ can be considered to apply forward (<tt>:patch</tt>) if the
127
- # following expression is true:
128
- #
129
- # patch(s1, diff(s1, s2)) -> s2
130
- #
131
- # A +patchset+ can be considered to apply backward (<tt>:unpatch</tt>) if the
132
- # following expression is true:
133
- #
134
- # patch(s2, diff(s1, s2)) -> s1
135
- #
136
- # If the +patchset+ contains no changes, the +src+ value will be returned as
137
- # either <tt>src.dup</tt> or +src+. A +patchset+ can be deemed as having no
138
- # changes if the following predicate returns true:
139
- #
140
- # patchset.empty? or
141
- # patchset.flatten(1).all? { |change| change.unchanged? }
142
- #
143
- # === Patchsets
144
- #
145
- # A +patchset+ is always an enumerable sequence of changes, hunks of changes,
146
- # or a mix of the two. A hunk of changes is an enumerable sequence of
147
- # changes:
148
- #
149
- # [ # patchset
150
- # # change
151
- # [ # hunk
152
- # # change
153
- # ]
154
- # ]
155
- #
156
- # The +patch+ method accepts <tt>patchset</tt>s that are enumerable sequences
157
- # containing either Diff::LCS::Change objects (or a subclass) or the array
158
- # representations of those objects. Prior to application, array
159
- # representations of Diff::LCS::Change objects will be reified.
160
- #
161
- # source://diff-lcs//lib/diff/lcs.rb#624
162
- def patch(src, patchset, direction = T.unsafe(nil)); end
163
-
164
- # Given a set of patchset, convert the current version to the next version.
165
- # Does no auto-discovery.
166
- #
167
- # source://diff-lcs//lib/diff/lcs.rb#734
168
- def patch!(src, patchset); end
169
-
170
- # #sdiff computes all necessary components to show two sequences and their
171
- # minimized differences side by side, just like the Unix utility
172
- # <em>sdiff</em> does:
173
- #
174
- # old < -
175
- # same same
176
- # before | after
177
- # - > new
178
- #
179
- # See Diff::LCS::SDiffCallbacks for the default behaviour. An alternate
180
- # behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
181
- # Class argument is provided for +callbacks+, #diff will attempt to
182
- # initialise it. If the +callbacks+ object (possibly initialised) responds to
183
- # #finish, it will be called.
184
- #
185
- # Each element of a returned array is a Diff::LCS::ContextChange object,
186
- # which can be implicitly converted to an array.
187
- #
188
- # Diff::LCS.sdiff(a, b).each do |action, (old_pos, old_element), (new_pos, new_element)|
189
- # case action
190
- # when '!'
191
- # # replace
192
- # when '-'
193
- # # delete
194
- # when '+'
195
- # # insert
196
- # end
197
- # end
198
- #
199
- # source://diff-lcs//lib/diff/lcs.rb#200
200
- def sdiff(seq1, seq2, callbacks = T.unsafe(nil), &block); end
201
-
202
- # #traverse_balanced is an alternative to #traverse_sequences. It uses a
203
- # different algorithm to iterate through the entries in the computed longest
204
- # common subsequence. Instead of viewing the changes as insertions or
205
- # deletions from one of the sequences, #traverse_balanced will report
206
- # <em>changes</em> between the sequences.
207
- #
208
- # The arguments to #traverse_balanced are the two sequences to traverse and a
209
- # callback object, like this:
210
- #
211
- # traverse_balanced(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
212
- #
213
- # #sdiff is implemented with #traverse_balanced.
214
- #
215
- # == Callback Methods
216
- #
217
- # Optional callback methods are <em>emphasized</em>.
218
- #
219
- # callbacks#match:: Called when +a+ and +b+ are pointing to
220
- # common elements in +A+ and +B+.
221
- # callbacks#discard_a:: Called when +a+ is pointing to an
222
- # element not in +B+.
223
- # callbacks#discard_b:: Called when +b+ is pointing to an
224
- # element not in +A+.
225
- # <em>callbacks#change</em>:: Called when +a+ and +b+ are pointing to
226
- # the same relative position, but
227
- # <tt>A[a]</tt> and <tt>B[b]</tt> are not
228
- # the same; a <em>change</em> has
229
- # occurred.
230
- #
231
- # #traverse_balanced might be a bit slower than #traverse_sequences,
232
- # noticable only while processing huge amounts of data.
233
- #
234
- # == Algorithm
235
- #
236
- # a---+
237
- # v
238
- # A = a b c e h j l m n p
239
- # B = b c d e f j k l m r s t
240
- # ^
241
- # b---+
242
- #
243
- # === Matches
244
- #
245
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
246
- # and +B+, the arrows will initially point to the first elements of their
247
- # respective sequences. #traverse_sequences will advance the arrows through
248
- # the sequences one element at a time, calling a method on the user-specified
249
- # callback object before each advance. It will advance the arrows in such a
250
- # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
251
- # both equal and part of the longest common subsequence, there will be some
252
- # moment during the execution of #traverse_sequences when arrow +a+ is
253
- # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
254
- # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
255
- # then it will advance both arrows.
256
- #
257
- # === Discards
258
- #
259
- # Otherwise, one of the arrows is pointing to an element of its sequence that
260
- # is not part of the longest common subsequence. #traverse_sequences will
261
- # advance that arrow and will call <tt>callbacks#discard_a</tt> or
262
- # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced.
263
- #
264
- # === Changes
265
- #
266
- # If both +a+ and +b+ point to elements that are not part of the longest
267
- # common subsequence, then #traverse_sequences will try to call
268
- # <tt>callbacks#change</tt> and advance both arrows. If
269
- # <tt>callbacks#change</tt> is not implemented, then
270
- # <tt>callbacks#discard_a</tt> and <tt>callbacks#discard_b</tt> will be
271
- # called in turn.
272
- #
273
- # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>,
274
- # <tt>callbacks#discard_b</tt>, and <tt>callbacks#change</tt> are invoked
275
- # with an event comprising the action ("=", "+", "-", or "!", respectively),
276
- # the indicies +i+ and +j+, and the elements <tt>A[i]</tt> and <tt>B[j]</tt>.
277
- # Return values are discarded by #traverse_balanced.
278
- #
279
- # === Context
280
- #
281
- # Note that +i+ and +j+ may not be the same index position, even if +a+ and
282
- # +b+ are considered to be pointing to matching or changed elements.
283
- #
284
- # source://diff-lcs//lib/diff/lcs.rb#475
285
- def traverse_balanced(seq1, seq2, callbacks = T.unsafe(nil)); end
286
-
287
- # #traverse_sequences is the most general facility provided by this module;
288
- # #diff and #lcs are implemented as calls to it.
289
- #
290
- # The arguments to #traverse_sequences are the two sequences to traverse, and
291
- # a callback object, like this:
292
- #
293
- # traverse_sequences(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
294
- #
295
- # == Callback Methods
296
- #
297
- # Optional callback methods are <em>emphasized</em>.
298
- #
299
- # callbacks#match:: Called when +a+ and +b+ are pointing to
300
- # common elements in +A+ and +B+.
301
- # callbacks#discard_a:: Called when +a+ is pointing to an
302
- # element not in +B+.
303
- # callbacks#discard_b:: Called when +b+ is pointing to an
304
- # element not in +A+.
305
- # <em>callbacks#finished_a</em>:: Called when +a+ has reached the end of
306
- # sequence +A+.
307
- # <em>callbacks#finished_b</em>:: Called when +b+ has reached the end of
308
- # sequence +B+.
309
- #
310
- # == Algorithm
311
- #
312
- # a---+
313
- # v
314
- # A = a b c e h j l m n p
315
- # B = b c d e f j k l m r s t
316
- # ^
317
- # b---+
318
- #
319
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
320
- # and +B+, the arrows will initially point to the first elements of their
321
- # respective sequences. #traverse_sequences will advance the arrows through
322
- # the sequences one element at a time, calling a method on the user-specified
323
- # callback object before each advance. It will advance the arrows in such a
324
- # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
325
- # both equal and part of the longest common subsequence, there will be some
326
- # moment during the execution of #traverse_sequences when arrow +a+ is
327
- # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
328
- # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
329
- # then it will advance both arrows.
330
- #
331
- # Otherwise, one of the arrows is pointing to an element of its sequence that
332
- # is not part of the longest common subsequence. #traverse_sequences will
333
- # advance that arrow and will call <tt>callbacks#discard_a</tt> or
334
- # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced. If both
335
- # arrows point to elements that are not part of the longest common
336
- # subsequence, then #traverse_sequences will advance arrow +a+ and call the
337
- # appropriate callback, then it will advance arrow +b+ and call the appropriate
338
- # callback.
339
- #
340
- # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>, and
341
- # <tt>callbacks#discard_b</tt> are invoked with an event comprising the
342
- # action ("=", "+", or "-", respectively), the indicies +i+ and +j+, and the
343
- # elements <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are discarded by
344
- # #traverse_sequences.
345
- #
346
- # === End of Sequences
347
- #
348
- # If arrow +a+ reaches the end of its sequence before arrow +b+ does,
349
- # #traverse_sequence will try to call <tt>callbacks#finished_a</tt> with the
350
- # last index and element of +A+ (<tt>A[-1]</tt>) and the current index and
351
- # element of +B+ (<tt>B[j]</tt>). If <tt>callbacks#finished_a</tt> does not
352
- # exist, then <tt>callbacks#discard_b</tt> will be called on each element of
353
- # +B+ until the end of the sequence is reached (the call will be done with
354
- # <tt>A[-1]</tt> and <tt>B[j]</tt> for each element).
355
- #
356
- # If +b+ reaches the end of +B+ before +a+ reaches the end of +A+,
357
- # <tt>callbacks#finished_b</tt> will be called with the current index and
358
- # element of +A+ (<tt>A[i]</tt>) and the last index and element of +B+
359
- # (<tt>A[-1]</tt>). Again, if <tt>callbacks#finished_b</tt> does not exist on
360
- # the callback object, then <tt>callbacks#discard_a</tt> will be called on
361
- # each element of +A+ until the end of the sequence is reached (<tt>A[i]</tt>
362
- # and <tt>B[-1]</tt>).
363
- #
364
- # There is a chance that one additional <tt>callbacks#discard_a</tt> or
365
- # <tt>callbacks#discard_b</tt> will be called after the end of the sequence
366
- # is reached, if +a+ has not yet reached the end of +A+ or +b+ has not yet
367
- # reached the end of +B+.
368
- #
369
- # source://diff-lcs//lib/diff/lcs.rb#285
370
- def traverse_sequences(seq1, seq2, callbacks = T.unsafe(nil)); end
371
-
372
- # Given a set of patchset, convert the current version to the prior version.
373
- # Does no auto-discovery.
374
- #
375
- # source://diff-lcs//lib/diff/lcs.rb#728
376
- def unpatch!(src, patchset); end
377
-
378
- private
379
-
380
- # source://diff-lcs//lib/diff/lcs/internals.rb#4
381
- def diff_traversal(method, seq1, seq2, callbacks, &block); end
382
- end
383
- end
384
-
385
- # An alias for DefaultCallbacks that is used in
386
- # Diff::LCS#traverse_balanced.
387
- #
388
- # Diff::LCS.LCS(seq1, seq2, Diff::LCS::BalancedCallbacks)
389
- #
390
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#50
391
- Diff::LCS::BalancedCallbacks = Diff::LCS::DefaultCallbacks
392
-
393
- # A block is an operation removing, adding, or changing a group of items.
394
- # Basically, this is just a list of changes, where each change adds or
395
- # deletes a single item. Used by bin/ldiff.
396
- #
397
- # source://diff-lcs//lib/diff/lcs/block.rb#6
398
- class Diff::LCS::Block
399
- # @return [Block] a new instance of Block
400
- #
401
- # source://diff-lcs//lib/diff/lcs/block.rb#9
402
- def initialize(chunk); end
403
-
404
- # Returns the value of attribute changes.
405
- #
406
- # source://diff-lcs//lib/diff/lcs/block.rb#7
407
- def changes; end
408
-
409
- # source://diff-lcs//lib/diff/lcs/block.rb#21
410
- def diff_size; end
411
-
412
- # Returns the value of attribute insert.
413
- #
414
- # source://diff-lcs//lib/diff/lcs/block.rb#7
415
- def insert; end
416
-
417
- # source://diff-lcs//lib/diff/lcs/block.rb#25
418
- def op; end
419
-
420
- # Returns the value of attribute remove.
421
- #
422
- # source://diff-lcs//lib/diff/lcs/block.rb#7
423
- def remove; end
424
- end
425
-
426
- # Represents a simplistic (non-contextual) change. Represents the removal or
427
- # addition of an element from either the old or the new sequenced
428
- # enumerable.
429
- #
430
- # source://diff-lcs//lib/diff/lcs/change.rb#6
431
- class Diff::LCS::Change
432
- include ::Comparable
433
-
434
- # @return [Change] a new instance of Change
435
- #
436
- # source://diff-lcs//lib/diff/lcs/change.rb#27
437
- def initialize(*args); end
438
-
439
- # source://diff-lcs//lib/diff/lcs/change.rb#65
440
- def <=>(other); end
441
-
442
- # source://diff-lcs//lib/diff/lcs/change.rb#58
443
- def ==(other); end
444
-
445
- # Returns the action this Change represents.
446
- #
447
- # source://diff-lcs//lib/diff/lcs/change.rb#20
448
- def action; end
449
-
450
- # @return [Boolean]
451
- #
452
- # source://diff-lcs//lib/diff/lcs/change.rb#72
453
- def adding?; end
454
-
455
- # @return [Boolean]
456
- #
457
- # source://diff-lcs//lib/diff/lcs/change.rb#84
458
- def changed?; end
459
-
460
- # @return [Boolean]
461
- #
462
- # source://diff-lcs//lib/diff/lcs/change.rb#76
463
- def deleting?; end
464
-
465
- # Returns the sequence element of the Change.
466
- #
467
- # source://diff-lcs//lib/diff/lcs/change.rb#25
468
- def element; end
469
-
470
- # @return [Boolean]
471
- #
472
- # source://diff-lcs//lib/diff/lcs/change.rb#88
473
- def finished_a?; end
474
-
475
- # @return [Boolean]
476
- #
477
- # source://diff-lcs//lib/diff/lcs/change.rb#92
478
- def finished_b?; end
479
-
480
- # source://diff-lcs//lib/diff/lcs/change.rb#34
481
- def inspect(*_args); end
482
-
483
- # Returns the position of the Change.
484
- #
485
- # source://diff-lcs//lib/diff/lcs/change.rb#23
486
- def position; end
487
-
488
- # source://diff-lcs//lib/diff/lcs/change.rb#38
489
- def to_a; end
490
-
491
- # source://diff-lcs//lib/diff/lcs/change.rb#38
492
- def to_ary; end
493
-
494
- # @return [Boolean]
495
- #
496
- # source://diff-lcs//lib/diff/lcs/change.rb#80
497
- def unchanged?; end
498
-
499
- class << self
500
- # source://diff-lcs//lib/diff/lcs/change.rb#44
501
- def from_a(arr); end
502
-
503
- # @return [Boolean]
504
- #
505
- # source://diff-lcs//lib/diff/lcs/change.rb#15
506
- def valid_action?(action); end
507
- end
508
- end
509
-
510
- # source://diff-lcs//lib/diff/lcs/change.rb#7
511
- Diff::LCS::Change::IntClass = Integer
512
-
513
- # The only actions valid for changes are '+' (add), '-' (delete), '='
514
- # (no change), '!' (changed), '<' (tail changes from first sequence), or
515
- # '>' (tail changes from second sequence). The last two ('<>') are only
516
- # found with Diff::LCS::diff and Diff::LCS::sdiff.
517
- #
518
- # source://diff-lcs//lib/diff/lcs/change.rb#13
519
- Diff::LCS::Change::VALID_ACTIONS = T.let(T.unsafe(nil), Array)
520
-
521
- # Represents a contextual change. Contains the position and values of the
522
- # elements in the old and the new sequenced enumerables as well as the action
523
- # taken.
524
- #
525
- # source://diff-lcs//lib/diff/lcs/change.rb#100
526
- class Diff::LCS::ContextChange < ::Diff::LCS::Change
527
- # @return [ContextChange] a new instance of ContextChange
528
- #
529
- # source://diff-lcs//lib/diff/lcs/change.rb#114
530
- def initialize(*args); end
531
-
532
- # source://diff-lcs//lib/diff/lcs/change.rb#166
533
- def <=>(other); end
534
-
535
- # source://diff-lcs//lib/diff/lcs/change.rb#157
536
- def ==(other); end
537
-
538
- # Returns the new element being changed.
539
- #
540
- # source://diff-lcs//lib/diff/lcs/change.rb#112
541
- def new_element; end
542
-
543
- # Returns the new position being changed.
544
- #
545
- # source://diff-lcs//lib/diff/lcs/change.rb#108
546
- def new_position; end
547
-
548
- # Returns the old element being changed.
549
- #
550
- # source://diff-lcs//lib/diff/lcs/change.rb#110
551
- def old_element; end
552
-
553
- # Returns the old position being changed.
554
- #
555
- # source://diff-lcs//lib/diff/lcs/change.rb#106
556
- def old_position; end
557
-
558
- # source://diff-lcs//lib/diff/lcs/change.rb#122
559
- def to_a; end
560
-
561
- # source://diff-lcs//lib/diff/lcs/change.rb#122
562
- def to_ary; end
563
-
564
- class << self
565
- # source://diff-lcs//lib/diff/lcs/change.rb#132
566
- def from_a(arr); end
567
-
568
- # Simplifies a context change for use in some diff callbacks. '<' actions
569
- # are converted to '-' and '>' actions are converted to '+'.
570
- #
571
- # source://diff-lcs//lib/diff/lcs/change.rb#138
572
- def simplify(event); end
573
- end
574
- end
575
-
576
- # This will produce a compound array of contextual diff change objects. Each
577
- # element in the #diffs array is a "hunk" array, where each element in each
578
- # "hunk" array is a single change. Each change is a Diff::LCS::ContextChange
579
- # that contains both the old index and new index values for the change. The
580
- # "hunk" provides the full context for the changes. Both old and new objects
581
- # will be presented for changed objects. +nil+ will be substituted for a
582
- # discarded object.
583
- #
584
- # seq1 = %w(a b c e h j l m n p)
585
- # seq2 = %w(b c d e f j k l m r s t)
586
- #
587
- # diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)
588
- # # This example shows a simplified array format.
589
- # # [ [ [ '-', [ 0, 'a' ], [ 0, nil ] ] ], # 1
590
- # # [ [ '+', [ 3, nil ], [ 2, 'd' ] ] ], # 2
591
- # # [ [ '-', [ 4, 'h' ], [ 4, nil ] ], # 3
592
- # # [ '+', [ 5, nil ], [ 4, 'f' ] ] ],
593
- # # [ [ '+', [ 6, nil ], [ 6, 'k' ] ] ], # 4
594
- # # [ [ '-', [ 8, 'n' ], [ 9, nil ] ], # 5
595
- # # [ '+', [ 9, nil ], [ 9, 'r' ] ],
596
- # # [ '-', [ 9, 'p' ], [ 10, nil ] ],
597
- # # [ '+', [ 10, nil ], [ 10, 's' ] ],
598
- # # [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]
599
- #
600
- # The five hunks shown are comprised of individual changes; if there is a
601
- # related set of changes, they are still shown individually.
602
- #
603
- # This callback can also be used with Diff::LCS#sdiff, which will produce
604
- # results like:
605
- #
606
- # diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)
607
- # # This example shows a simplified array format.
608
- # # [ [ [ "-", [ 0, "a" ], [ 0, nil ] ] ], # 1
609
- # # [ [ "+", [ 3, nil ], [ 2, "d" ] ] ], # 2
610
- # # [ [ "!", [ 4, "h" ], [ 4, "f" ] ] ], # 3
611
- # # [ [ "+", [ 6, nil ], [ 6, "k" ] ] ], # 4
612
- # # [ [ "!", [ 8, "n" ], [ 9, "r" ] ], # 5
613
- # # [ "!", [ 9, "p" ], [ 10, "s" ] ],
614
- # # [ "+", [ 10, nil ], [ 11, "t" ] ] ] ]
615
- #
616
- # The five hunks are still present, but are significantly shorter in total
617
- # presentation, because changed items are shown as changes ("!") instead of
618
- # potentially "mismatched" pairs of additions and deletions.
619
- #
620
- # The result of this operation is similar to that of
621
- # Diff::LCS::SDiffCallbacks. They may be compared as:
622
- #
623
- # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
624
- # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
625
- #
626
- # s == c # -> true
627
- #
628
- # === Use
629
- #
630
- # This callback object must be initialised and can be used by the
631
- # Diff::LCS#diff or Diff::LCS#sdiff methods.
632
- #
633
- # cbo = Diff::LCS::ContextDiffCallbacks.new
634
- # Diff::LCS.LCS(seq1, seq2, cbo)
635
- # cbo.finish
636
- #
637
- # Note that the call to #finish is absolutely necessary, or the last set of
638
- # changes will not be visible. Alternatively, can be used as:
639
- #
640
- # cbo = Diff::LCS::ContextDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
641
- #
642
- # The necessary #finish call will be made.
643
- #
644
- # === Simplified Array Format
645
- #
646
- # The simplified array format used in the example above can be obtained
647
- # with:
648
- #
649
- # require 'pp'
650
- # pp diffs.map { |e| e.map { |f| f.to_a } }
651
- #
652
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#223
653
- class Diff::LCS::ContextDiffCallbacks < ::Diff::LCS::DiffCallbacks
654
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#232
655
- def change(event); end
656
-
657
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#224
658
- def discard_a(event); end
659
-
660
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#228
661
- def discard_b(event); end
662
- end
663
-
664
- # This callback object implements the default set of callback events,
665
- # which only returns the event itself. Note that #finished_a and
666
- # #finished_b are not implemented -- I haven't yet figured out where they
667
- # would be useful.
668
- #
669
- # Note that this is intended to be called as is, e.g.,
670
- #
671
- # Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
672
- #
673
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#14
674
- class Diff::LCS::DefaultCallbacks
675
- class << self
676
- # Called when both the old and new values have changed.
677
- #
678
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#32
679
- def change(event); end
680
-
681
- # Called when the old value is discarded in favour of the new value.
682
- #
683
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#22
684
- def discard_a(event); end
685
-
686
- # Called when the new value is discarded in favour of the old value.
687
- #
688
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#27
689
- def discard_b(event); end
690
-
691
- # Called when two items match.
692
- #
693
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#17
694
- def match(event); end
695
-
696
- private
697
-
698
- def new(*_arg0); end
699
- end
700
- end
701
-
702
- # This will produce a compound array of simple diff change objects. Each
703
- # element in the #diffs array is a +hunk+ or +hunk+ array, where each
704
- # element in each +hunk+ array is a single Change object representing the
705
- # addition or removal of a single element from one of the two tested
706
- # sequences. The +hunk+ provides the full context for the changes.
707
- #
708
- # diffs = Diff::LCS.diff(seq1, seq2)
709
- # # This example shows a simplified array format.
710
- # # [ [ [ '-', 0, 'a' ] ], # 1
711
- # # [ [ '+', 2, 'd' ] ], # 2
712
- # # [ [ '-', 4, 'h' ], # 3
713
- # # [ '+', 4, 'f' ] ],
714
- # # [ [ '+', 6, 'k' ] ], # 4
715
- # # [ [ '-', 8, 'n' ], # 5
716
- # # [ '-', 9, 'p' ],
717
- # # [ '+', 9, 'r' ],
718
- # # [ '+', 10, 's' ],
719
- # # [ '+', 11, 't' ] ] ]
720
- #
721
- # There are five hunks here. The first hunk says that the +a+ at position 0
722
- # of the first sequence should be deleted (<tt>'-'</tt>). The second hunk
723
- # says that the +d+ at position 2 of the second sequence should be inserted
724
- # (<tt>'+'</tt>). The third hunk says that the +h+ at position 4 of the
725
- # first sequence should be removed and replaced with the +f+ from position 4
726
- # of the second sequence. The other two hunks are described similarly.
727
- #
728
- # === Use
729
- #
730
- # This callback object must be initialised and is used by the Diff::LCS#diff
731
- # method.
732
- #
733
- # cbo = Diff::LCS::DiffCallbacks.new
734
- # Diff::LCS.LCS(seq1, seq2, cbo)
735
- # cbo.finish
736
- #
737
- # Note that the call to #finish is absolutely necessary, or the last set of
738
- # changes will not be visible. Alternatively, can be used as:
739
- #
740
- # cbo = Diff::LCS::DiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
741
- #
742
- # The necessary #finish call will be made.
743
- #
744
- # === Simplified Array Format
745
- #
746
- # The simplified array format used in the example above can be obtained
747
- # with:
748
- #
749
- # require 'pp'
750
- # pp diffs.map { |e| e.map { |f| f.to_a } }
751
- #
752
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#106
753
- class Diff::LCS::DiffCallbacks
754
- # :yields self:
755
- #
756
- # @return [DiffCallbacks] a new instance of DiffCallbacks
757
- #
758
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#110
759
- def initialize; end
760
-
761
- # Returns the difference set collected during the diff process.
762
- #
763
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#108
764
- def diffs; end
765
-
766
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#133
767
- def discard_a(event); end
768
-
769
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#137
770
- def discard_b(event); end
771
-
772
- # Finalizes the diff process. If an unprocessed hunk still exists, then it
773
- # is appended to the diff list.
774
- #
775
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#125
776
- def finish; end
777
-
778
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#129
779
- def match(_event); end
780
-
781
- private
782
-
783
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#141
784
- def finish_hunk; end
785
- end
786
-
787
- # A Hunk is a group of Blocks which overlap because of the context surrounding
788
- # each block. (So if we're not using context, every hunk will contain one
789
- # block.) Used in the diff program (bin/ldiff).
790
- #
791
- # source://diff-lcs//lib/diff/lcs/hunk.rb#8
792
- class Diff::LCS::Hunk
793
- # Create a hunk using references to both the old and new data, as well as the
794
- # piece of data.
795
- #
796
- # @return [Hunk] a new instance of Hunk
797
- #
798
- # source://diff-lcs//lib/diff/lcs/hunk.rb#16
799
- def initialize(data_old, data_new, piece, flag_context, file_length_difference); end
800
-
801
- # Returns the value of attribute blocks.
802
- #
803
- # source://diff-lcs//lib/diff/lcs/hunk.rb#63
804
- def blocks; end
805
-
806
- # Returns a diff string based on a format.
807
- #
808
- # source://diff-lcs//lib/diff/lcs/hunk.rb#116
809
- def diff(format, last = T.unsafe(nil)); end
810
-
811
- # Returns the value of attribute end_new.
812
- #
813
- # source://diff-lcs//lib/diff/lcs/hunk.rb#65
814
- def end_new; end
815
-
816
- # Returns the value of attribute end_old.
817
- #
818
- # source://diff-lcs//lib/diff/lcs/hunk.rb#65
819
- def end_old; end
820
-
821
- # Returns the value of attribute file_length_difference.
822
- #
823
- # source://diff-lcs//lib/diff/lcs/hunk.rb#66
824
- def file_length_difference; end
825
-
826
- # Change the "start" and "end" fields to note that context should be added
827
- # to this hunk.
828
- #
829
- # source://diff-lcs//lib/diff/lcs/hunk.rb#70
830
- def flag_context; end
831
-
832
- # source://diff-lcs//lib/diff/lcs/hunk.rb#72
833
- def flag_context=(context); end
834
-
835
- # Merges this hunk and the provided hunk together if they overlap. Returns
836
- # a truthy value so that if there is no overlap, you can know the merge
837
- # was skipped.
838
- #
839
- # source://diff-lcs//lib/diff/lcs/hunk.rb#98
840
- def merge(hunk); end
841
-
842
- # @return [Boolean]
843
- #
844
- # source://diff-lcs//lib/diff/lcs/hunk.rb#326
845
- def missing_last_newline?(data); end
846
-
847
- # Determines whether there is an overlap between this hunk and the
848
- # provided hunk. This will be true if the difference between the two hunks
849
- # start or end positions is within one position of each other.
850
- #
851
- # @return [Boolean]
852
- #
853
- # source://diff-lcs//lib/diff/lcs/hunk.rb#110
854
- def overlaps?(hunk); end
855
-
856
- # Returns the value of attribute start_new.
857
- #
858
- # source://diff-lcs//lib/diff/lcs/hunk.rb#64
859
- def start_new; end
860
-
861
- # Returns the value of attribute start_old.
862
- #
863
- # source://diff-lcs//lib/diff/lcs/hunk.rb#64
864
- def start_old; end
865
-
866
- # Merges this hunk and the provided hunk together if they overlap. Returns
867
- # a truthy value so that if there is no overlap, you can know the merge
868
- # was skipped.
869
- #
870
- # source://diff-lcs//lib/diff/lcs/hunk.rb#98
871
- def unshift(hunk); end
872
-
873
- private
874
-
875
- # source://diff-lcs//lib/diff/lcs/hunk.rb#213
876
- def context_diff(last = T.unsafe(nil)); end
877
-
878
- # Generate a range of item numbers to print. Only print 1 number if the
879
- # range has only one item in it. Otherwise, it's 'start,end'
880
- #
881
- # source://diff-lcs//lib/diff/lcs/hunk.rb#293
882
- def context_range(mode, op, last = T.unsafe(nil)); end
883
-
884
- # source://diff-lcs//lib/diff/lcs/hunk.rb#271
885
- def ed_diff(format, _last = T.unsafe(nil)); end
886
-
887
- # source://diff-lcs//lib/diff/lcs/hunk.rb#339
888
- def encode(literal, target_encoding = T.unsafe(nil)); end
889
-
890
- # source://diff-lcs//lib/diff/lcs/hunk.rb#343
891
- def encode_as(string, *args); end
892
-
893
- # Note that an old diff can't have any context. Therefore, we know that
894
- # there's only one block in the hunk.
895
- #
896
- # source://diff-lcs//lib/diff/lcs/hunk.rb#135
897
- def old_diff(_last = T.unsafe(nil)); end
898
-
899
- # source://diff-lcs//lib/diff/lcs/hunk.rb#160
900
- def unified_diff(last = T.unsafe(nil)); end
901
-
902
- # Generate a range of item numbers to print for unified diff. Print number
903
- # where block starts, followed by number of lines in the block
904
- # (don't print number of lines if it's 1)
905
- #
906
- # source://diff-lcs//lib/diff/lcs/hunk.rb#311
907
- def unified_range(mode, last); end
908
- end
909
-
910
- # source://diff-lcs//lib/diff/lcs/hunk.rb#10
911
- Diff::LCS::Hunk::ED_DIFF_OP_ACTION = T.let(T.unsafe(nil), Hash)
912
-
913
- # source://diff-lcs//lib/diff/lcs/hunk.rb#9
914
- Diff::LCS::Hunk::OLD_DIFF_OP_ACTION = T.let(T.unsafe(nil), Hash)
915
-
916
- # source://diff-lcs//lib/diff/lcs/internals.rb#29
917
- module Diff::LCS::Internals
918
- class << self
919
- # This method will analyze the provided patchset to provide a single-pass
920
- # normalization (conversion of the array form of Diff::LCS::Change objects to
921
- # the object form of same) and detection of whether the patchset represents
922
- # changes to be made.
923
- #
924
- # source://diff-lcs//lib/diff/lcs/internals.rb#102
925
- def analyze_patchset(patchset, depth = T.unsafe(nil)); end
926
-
927
- # Examine the patchset and the source to see in which direction the
928
- # patch should be applied.
929
- #
930
- # WARNING: By default, this examines the whole patch, so this could take
931
- # some time. This also works better with Diff::LCS::ContextChange or
932
- # Diff::LCS::Change as its source, as an array will cause the creation
933
- # of one of the above.
934
- #
935
- # source://diff-lcs//lib/diff/lcs/internals.rb#147
936
- def intuit_diff_direction(src, patchset, limit = T.unsafe(nil)); end
937
-
938
- # Compute the longest common subsequence between the sequenced
939
- # Enumerables +a+ and +b+. The result is an array whose contents is such
940
- # that
941
- #
942
- # result = Diff::LCS::Internals.lcs(a, b)
943
- # result.each_with_index do |e, i|
944
- # assert_equal(a[i], b[e]) unless e.nil?
945
- # end
946
- #
947
- # source://diff-lcs//lib/diff/lcs/internals.rb#41
948
- def lcs(a, b); end
949
-
950
- private
951
-
952
- # If +vector+ maps the matching elements of another collection onto this
953
- # Enumerable, compute the inverse of +vector+ that maps this Enumerable
954
- # onto the collection. (Currently unused.)
955
- #
956
- # source://diff-lcs//lib/diff/lcs/internals.rb#286
957
- def inverse_vector(a, vector); end
958
-
959
- # Returns a hash mapping each element of an Enumerable to the set of
960
- # positions it occupies in the Enumerable, optionally restricted to the
961
- # elements specified in the range of indexes specified by +interval+.
962
- #
963
- # source://diff-lcs//lib/diff/lcs/internals.rb#298
964
- def position_hash(enum, interval); end
965
-
966
- # Find the place at which +value+ would normally be inserted into the
967
- # Enumerable. If that place is already occupied by +value+, do nothing
968
- # and return +nil+. If the place does not exist (i.e., it is off the end
969
- # of the Enumerable), add it to the end. Otherwise, replace the element
970
- # at that point with +value+. It is assumed that the Enumerable's values
971
- # are numeric.
972
- #
973
- # This operation preserves the sort order.
974
- #
975
- # source://diff-lcs//lib/diff/lcs/internals.rb#252
976
- def replace_next_larger(enum, value, last_index = T.unsafe(nil)); end
977
- end
978
- end
979
-
980
- # This will produce a simple array of diff change objects. Each element in
981
- # the #diffs array is a single ContextChange. In the set of #diffs provided
982
- # by SDiffCallbacks, both old and new objects will be presented for both
983
- # changed <strong>and unchanged</strong> objects. +nil+ will be substituted
984
- # for a discarded object.
985
- #
986
- # The diffset produced by this callback, when provided to Diff::LCS#sdiff,
987
- # will compute and display the necessary components to show two sequences
988
- # and their minimized differences side by side, just like the Unix utility
989
- # +sdiff+.
990
- #
991
- # same same
992
- # before | after
993
- # old < -
994
- # - > new
995
- #
996
- # seq1 = %w(a b c e h j l m n p)
997
- # seq2 = %w(b c d e f j k l m r s t)
998
- #
999
- # diffs = Diff::LCS.sdiff(seq1, seq2)
1000
- # # This example shows a simplified array format.
1001
- # # [ [ "-", [ 0, "a"], [ 0, nil ] ],
1002
- # # [ "=", [ 1, "b"], [ 0, "b" ] ],
1003
- # # [ "=", [ 2, "c"], [ 1, "c" ] ],
1004
- # # [ "+", [ 3, nil], [ 2, "d" ] ],
1005
- # # [ "=", [ 3, "e"], [ 3, "e" ] ],
1006
- # # [ "!", [ 4, "h"], [ 4, "f" ] ],
1007
- # # [ "=", [ 5, "j"], [ 5, "j" ] ],
1008
- # # [ "+", [ 6, nil], [ 6, "k" ] ],
1009
- # # [ "=", [ 6, "l"], [ 7, "l" ] ],
1010
- # # [ "=", [ 7, "m"], [ 8, "m" ] ],
1011
- # # [ "!", [ 8, "n"], [ 9, "r" ] ],
1012
- # # [ "!", [ 9, "p"], [ 10, "s" ] ],
1013
- # # [ "+", [ 10, nil], [ 11, "t" ] ] ]
1014
- #
1015
- # The result of this operation is similar to that of
1016
- # Diff::LCS::ContextDiffCallbacks. They may be compared as:
1017
- #
1018
- # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
1019
- # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
1020
- #
1021
- # s == c # -> true
1022
- #
1023
- # === Use
1024
- #
1025
- # This callback object must be initialised and is used by the Diff::LCS#sdiff
1026
- # method.
1027
- #
1028
- # cbo = Diff::LCS::SDiffCallbacks.new
1029
- # Diff::LCS.LCS(seq1, seq2, cbo)
1030
- #
1031
- # As with the other initialisable callback objects,
1032
- # Diff::LCS::SDiffCallbacks can be initialised with a block. As there is no
1033
- # "fininishing" to be done, this has no effect on the state of the object.
1034
- #
1035
- # cbo = Diff::LCS::SDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
1036
- #
1037
- # === Simplified Array Format
1038
- #
1039
- # The simplified array format used in the example above can be obtained
1040
- # with:
1041
- #
1042
- # require 'pp'
1043
- # pp diffs.map { |e| e.to_a }
1044
- #
1045
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#301
1046
- class Diff::LCS::SDiffCallbacks
1047
- # :yields self:
1048
- #
1049
- # @return [SDiffCallbacks] a new instance of SDiffCallbacks
1050
- # @yield [_self]
1051
- # @yieldparam _self [Diff::LCS::SDiffCallbacks] the object that the method was called on
1052
- #
1053
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#305
1054
- def initialize; end
1055
-
1056
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#322
1057
- def change(event); end
1058
-
1059
- # Returns the difference set collected during the diff process.
1060
- #
1061
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#303
1062
- def diffs; end
1063
-
1064
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#314
1065
- def discard_a(event); end
1066
-
1067
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#318
1068
- def discard_b(event); end
1069
-
1070
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#310
1071
- def match(event); end
1072
- end
1073
-
1074
- # An alias for DefaultCallbacks that is used in
1075
- # Diff::LCS#traverse_sequences.
1076
- #
1077
- # Diff::LCS.LCS(seq1, seq2, Diff::LCS::SequenceCallbacks)
1078
- #
1079
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#44
1080
- Diff::LCS::SequenceCallbacks = Diff::LCS::DefaultCallbacks
1081
-
1082
- # source://diff-lcs//lib/diff/lcs.rb#52
1083
- Diff::LCS::VERSION = T.let(T.unsafe(nil), String)