mootool 0.1.0 → 0.2

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