checkoff 0.223.0 → 0.226.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/checkoff.gemspec +10 -5
  3. data/lib/checkoff/attachments.rb +1 -1
  4. data/lib/checkoff/cli.rb +1 -1
  5. data/lib/checkoff/clients.rb +1 -1
  6. data/lib/checkoff/custom_fields.rb +1 -1
  7. data/lib/checkoff/events.rb +1 -1
  8. data/lib/checkoff/internal/config_loader.rb +2 -3
  9. data/lib/checkoff/internal/selector_classes/section/function_evaluator.rb +3 -2
  10. data/lib/checkoff/my_tasks.rb +1 -1
  11. data/lib/checkoff/portfolios.rb +11 -9
  12. data/lib/checkoff/projects.rb +1 -1
  13. data/lib/checkoff/sections.rb +4 -5
  14. data/lib/checkoff/tags.rb +66 -17
  15. data/lib/checkoff/tasks.rb +1 -1
  16. data/lib/checkoff/version.rb +1 -1
  17. data/lib/checkoff/workspaces.rb +1 -1
  18. data/rbi/checkoff.rbi +4529 -0
  19. data/sig/checkoff.rbs +3749 -0
  20. metadata +5 -211
  21. data/.circleci/config.yml +0 -291
  22. data/.envrc +0 -9
  23. data/.git-hooks/pre_commit/circle_ci.rb +0 -26
  24. data/.git-hooks/pre_commit/punchlist.rb +0 -52
  25. data/.git-hooks/pre_commit/solargraph_typecheck.rb +0 -77
  26. data/.gitattributes +0 -6
  27. data/.gitignore +0 -65
  28. data/.markdownlint_style.rb +0 -4
  29. data/.mdlrc +0 -1
  30. data/.overcommit.yml +0 -115
  31. data/.rubocop.yml +0 -143
  32. data/.rubocop_todo.yml +0 -90
  33. data/.solargraph.yml +0 -35
  34. data/.yamllint.yml +0 -8
  35. data/.yardopts +0 -2
  36. data/CODE_OF_CONDUCT.md +0 -133
  37. data/CONTRIBUTING.rst +0 -75
  38. data/DEVELOPMENT.md +0 -69
  39. data/GLOSSARY.md +0 -16
  40. data/Gemfile +0 -67
  41. data/Gemfile.lock +0 -351
  42. data/LICENSE +0 -21
  43. data/Makefile +0 -139
  44. data/bin/brakeman +0 -27
  45. data/bin/bump +0 -29
  46. data/bin/checkoff +0 -29
  47. data/bin/console +0 -15
  48. data/bin/overcommit +0 -29
  49. data/bin/overcommit_branch +0 -114
  50. data/bin/rake +0 -29
  51. data/bin/rubocop +0 -27
  52. data/bin/setup +0 -8
  53. data/bin/solargraph +0 -27
  54. data/bin/sord +0 -27
  55. data/bin/spoom +0 -27
  56. data/bin/srb +0 -27
  57. data/bin/srb-rbi +0 -27
  58. data/bin/tapioca +0 -27
  59. data/bin/yard +0 -27
  60. data/config/annotations_asana.rb +0 -253
  61. data/config/annotations_misc.rb +0 -68
  62. data/config/env.1p +0 -2
  63. data/docs/.gitignore +0 -3
  64. data/docs/cookiecutter_input.json +0 -17
  65. data/docs/example_project.png +0 -0
  66. data/fix.sh +0 -534
  67. data/metrics/bigfiles_high_water_mark +0 -1
  68. data/metrics/brakeman_high_water_mark +0 -1
  69. data/metrics/bundle-audit_high_water_mark +0 -1
  70. data/metrics/cane_high_water_mark +0 -1
  71. data/metrics/eslint_high_water_mark +0 -1
  72. data/metrics/flake8_high_water_mark +0 -1
  73. data/metrics/flay_high_water_mark +0 -1
  74. data/metrics/flog_high_water_mark +0 -1
  75. data/metrics/jscs_high_water_mark +0 -1
  76. data/metrics/mdl_high_water_mark +0 -1
  77. data/metrics/pep8_high_water_mark +0 -1
  78. data/metrics/punchlist_high_water_mark +0 -1
  79. data/metrics/pycodestyle_high_water_mark +0 -1
  80. data/metrics/rails_best_practices_high_water_mark +0 -1
  81. data/metrics/rubocop_high_water_mark +0 -1
  82. data/metrics/scalastyle_high_water_mark +0 -1
  83. data/metrics/shellcheck_high_water_mark +0 -1
  84. data/package.json +0 -9
  85. data/rakelib/citest.rake +0 -4
  86. data/rakelib/clear_metrics.rake +0 -9
  87. data/rakelib/console.rake +0 -15
  88. data/rakelib/default.rake +0 -4
  89. data/rakelib/doc.rake +0 -6
  90. data/rakelib/gem_tasks.rake +0 -3
  91. data/rakelib/localtest.rake +0 -4
  92. data/rakelib/overcommit.rake +0 -6
  93. data/rakelib/quality.rake +0 -4
  94. data/rakelib/repl.rake +0 -4
  95. data/rakelib/test.rake +0 -10
  96. data/rakelib/trigger_next_builds.rake +0 -7
  97. data/rakelib/undercover.rake +0 -8
  98. data/requirements_dev.txt +0 -2
  99. data/sorbet/config +0 -4
  100. data/sorbet/rbi/annotations/.gitattributes +0 -1
  101. data/sorbet/rbi/annotations/activesupport.rbi +0 -453
  102. data/sorbet/rbi/annotations/faraday.rbi +0 -17
  103. data/sorbet/rbi/annotations/minitest.rbi +0 -119
  104. data/sorbet/rbi/annotations/mocha.rbi +0 -34
  105. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  106. data/sorbet/rbi/annotations/webmock.rbi +0 -9
  107. data/sorbet/rbi/dsl/.gitattributes +0 -1
  108. data/sorbet/rbi/dsl/active_support/callbacks.rbi +0 -23
  109. data/sorbet/rbi/gems/.gitattributes +0 -1
  110. data/sorbet/rbi/gems/activesupport@7.1.5.rbi +0 -18746
  111. data/sorbet/rbi/gems/addressable@2.8.6.rbi +0 -1994
  112. data/sorbet/rbi/gems/ansi@1.5.0.rbi +0 -688
  113. data/sorbet/rbi/gems/asana@0.10.6-ab9393136d9ca59b75e42a661fdddc1c65c8f7c3.rbi +0 -6142
  114. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -585
  115. data/sorbet/rbi/gems/backport@1.2.0.rbi +0 -523
  116. data/sorbet/rbi/gems/base64@0.2.0.rbi +0 -509
  117. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +0 -618
  118. data/sorbet/rbi/gems/bigdecimal@3.1.5.rbi +0 -78
  119. data/sorbet/rbi/gems/brakeman@6.2.2.rbi +0 -222
  120. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -505
  121. data/sorbet/rbi/gems/bump@0.10.0.rbi +0 -169
  122. data/sorbet/rbi/gems/cache@0.4.1.rbi +0 -211
  123. data/sorbet/rbi/gems/cache_method@0.2.7.rbi +0 -293
  124. data/sorbet/rbi/gems/chef-utils@18.3.0.rbi +0 -9
  125. data/sorbet/rbi/gems/childprocess@5.1.0.rbi +0 -383
  126. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3427
  127. data/sorbet/rbi/gems/commander@4.6.0.rbi +0 -9
  128. data/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi +0 -11591
  129. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +0 -9
  130. data/sorbet/rbi/gems/crack@0.4.5.rbi +0 -145
  131. data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +0 -969
  132. data/sorbet/rbi/gems/docile@1.4.0.rbi +0 -377
  133. data/sorbet/rbi/gems/drb@2.2.1.rbi +0 -1347
  134. data/sorbet/rbi/gems/e2mmap@0.1.0.rbi +0 -9
  135. data/sorbet/rbi/gems/erubi@1.13.0.rbi +0 -152
  136. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +0 -222
  137. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +0 -126
  138. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +0 -136
  139. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +0 -145
  140. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +0 -259
  141. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +0 -142
  142. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +0 -118
  143. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +0 -125
  144. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +0 -133
  145. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +0 -198
  146. data/sorbet/rbi/gems/faraday@1.10.3.rbi +0 -2729
  147. data/sorbet/rbi/gems/faraday_middleware-multi_json@0.0.6.rbi +0 -29
  148. data/sorbet/rbi/gems/faraday_middleware@1.2.0.rbi +0 -1004
  149. data/sorbet/rbi/gems/gli@2.22.0.rbi +0 -9
  150. data/sorbet/rbi/gems/hashdiff@1.0.1.rbi +0 -351
  151. data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -9
  152. data/sorbet/rbi/gems/i18n@1.14.6.rbi +0 -2359
  153. data/sorbet/rbi/gems/imagen@0.1.8.rbi +0 -340
  154. data/sorbet/rbi/gems/iniparse@1.5.0.rbi +0 -899
  155. data/sorbet/rbi/gems/jaro_winkler@1.6.0.rbi +0 -22
  156. data/sorbet/rbi/gems/json@2.7.1.rbi +0 -1562
  157. data/sorbet/rbi/gems/jwt@2.7.1.rbi +0 -1405
  158. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +0 -128
  159. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +0 -3272
  160. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14238
  161. data/sorbet/rbi/gems/logger@1.6.2.rbi +0 -923
  162. data/sorbet/rbi/gems/mdl@0.13.0.rbi +0 -445
  163. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -273
  164. data/sorbet/rbi/gems/mime-types-data@3.2023.1205.rbi +0 -127
  165. data/sorbet/rbi/gems/mime-types@3.5.1.rbi +0 -1252
  166. data/sorbet/rbi/gems/minitest-profile@0.0.2.rbi +0 -136
  167. data/sorbet/rbi/gems/minitest-reporters@1.6.1.rbi +0 -1014
  168. data/sorbet/rbi/gems/minitest@5.21.1.rbi +0 -1539
  169. data/sorbet/rbi/gems/mixlib-cli@2.1.8.rbi +0 -314
  170. data/sorbet/rbi/gems/mixlib-config@3.0.27.rbi +0 -581
  171. data/sorbet/rbi/gems/mixlib-shellout@3.2.7.rbi +0 -629
  172. data/sorbet/rbi/gems/mocha@2.1.0.rbi +0 -12
  173. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +0 -268
  174. data/sorbet/rbi/gems/multi_xml@0.6.0.rbi +0 -102
  175. data/sorbet/rbi/gems/multipart-post@2.3.0.rbi +0 -234
  176. data/sorbet/rbi/gems/mutex_m@0.3.0.rbi +0 -97
  177. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -159
  178. data/sorbet/rbi/gems/nokogiri@1.17.0.rbi +0 -8201
  179. data/sorbet/rbi/gems/oauth2@1.4.11.rbi +0 -833
  180. data/sorbet/rbi/gems/overcommit@0.64.1.rbi +0 -2400
  181. data/sorbet/rbi/gems/parallel@1.23.0.rbi +0 -274
  182. data/sorbet/rbi/gems/parlour@5.0.0.rbi +0 -3007
  183. data/sorbet/rbi/gems/parser@3.2.2.4.rbi +0 -7253
  184. data/sorbet/rbi/gems/prism@1.2.0.rbi +0 -39085
  185. data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10070
  186. data/sorbet/rbi/gems/public_suffix@5.0.4.rbi +0 -936
  187. data/sorbet/rbi/gems/punchlist@1.3.2.rbi +0 -173
  188. data/sorbet/rbi/gems/racc@1.8.1.rbi +0 -162
  189. data/sorbet/rbi/gems/rack@3.1.8.rbi +0 -4896
  190. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -403
  191. data/sorbet/rbi/gems/rake@13.1.0.rbi +0 -3022
  192. data/sorbet/rbi/gems/rbi@0.2.1.rbi +0 -4535
  193. data/sorbet/rbi/gems/rbs@2.8.4.rbi +0 -5613
  194. data/sorbet/rbi/gems/regexp_parser@2.8.3.rbi +0 -3750
  195. data/sorbet/rbi/gems/reverse_markdown@2.1.1.rbi +0 -390
  196. data/sorbet/rbi/gems/rexml@3.3.9.rbi +0 -4964
  197. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +0 -7127
  198. data/sorbet/rbi/gems/rubocop-minitest@0.34.5.rbi +0 -2577
  199. data/sorbet/rbi/gems/rubocop-performance@1.20.2.rbi +0 -3262
  200. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +0 -329
  201. data/sorbet/rbi/gems/rubocop-rspec@3.0.0.rbi +0 -7546
  202. data/sorbet/rbi/gems/rubocop@1.59.0.rbi +0 -57238
  203. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1318
  204. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +0 -9
  205. data/sorbet/rbi/gems/rugged@1.6.3.rbi +0 -1577
  206. data/sorbet/rbi/gems/securerandom@0.4.0.rbi +0 -75
  207. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +0 -217
  208. data/sorbet/rbi/gems/simplecov-lcov@0.8.0.rbi +0 -256
  209. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +0 -2149
  210. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +0 -9
  211. data/sorbet/rbi/gems/solargraph-rails@1.1.0-9dc37915bd4f3b169046e34db6fb32193ab347d8.rbi +0 -320
  212. data/sorbet/rbi/gems/solargraph@0.50.1-904b9304770a59fac393c5cc3cad481e5bdf0fd8.rbi +0 -9396
  213. data/sorbet/rbi/gems/sord@5.1.0.rbi +0 -820
  214. data/sorbet/rbi/gems/source_finder@3.2.1.rbi +0 -317
  215. data/sorbet/rbi/gems/spoom@1.5.0.rbi +0 -4932
  216. data/sorbet/rbi/gems/tapioca@0.16.5.rbi +0 -3617
  217. data/sorbet/rbi/gems/thor@1.3.2.rbi +0 -4378
  218. data/sorbet/rbi/gems/tilt@2.4.0.rbi +0 -933
  219. data/sorbet/rbi/gems/tomlrb@2.0.3.rbi +0 -9
  220. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +0 -5918
  221. data/sorbet/rbi/gems/undercover@0.5.0.rbi +0 -433
  222. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +0 -66
  223. data/sorbet/rbi/gems/webmock@3.19.1.rbi +0 -1769
  224. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
  225. data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18406
  226. data/sorbet/rbi/todo.rbi +0 -11
  227. data/sorbet/tapioca/config.yml +0 -13
  228. data/sorbet/tapioca/require.rb +0 -4
@@ -1,969 +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
-
8
- # source://diff-lcs//lib/diff/lcs.rb#3
9
- module Diff; end
10
-
11
- # == How Diff Works (by Mark-Jason Dominus)
12
- #
13
- # I once read an article written by the authors of +diff+; they said that they
14
- # hard worked very hard on the algorithm until they found the right one.
15
- #
16
- # I think what they ended up using (and I hope someone will correct me, because
17
- # I am not very confident about this) was the `longest common subsequence'
18
- # method. In the LCS problem, you have two sequences of items:
19
- #
20
- # a b c d f g h j q z
21
- # a b c d e f g i j k r x y z
22
- #
23
- # and you want to find the longest sequence of items that is present in both
24
- # original sequences in the same order. That is, you want to find a new
25
- # sequence *S* which can be obtained from the first sequence by deleting some
26
- # items, and from the second sequence by deleting other items. You also want
27
- # *S* to be as long as possible. In this case *S* is:
28
- #
29
- # a b c d f g j z
30
- #
31
- # From there it's only a small step to get diff-like output:
32
- #
33
- # e h i k q r x y
34
- # + - + + - + + +
35
- #
36
- # This module solves the LCS problem. It also includes a canned function to
37
- # generate +diff+-like output.
38
- #
39
- # It might seem from the example above that the LCS of two sequences is always
40
- # pretty obvious, but that's not always the case, especially when the two
41
- # sequences have many repeated elements. For example, consider
42
- #
43
- # a x b y c z p d q
44
- # a b c a x b y c z
45
- #
46
- # A naive approach might start by matching up the +a+ and +b+ that appear at
47
- # the beginning of each sequence, like this:
48
- #
49
- # a x b y c z p d q
50
- # a b c a b y c z
51
- #
52
- # This finds the common subsequence +a b c z+. But actually, the LCS is +a x b
53
- # y c z+:
54
- #
55
- # a x b y c z p d q
56
- # a b c a x b y c z
57
- #
58
- # source://diff-lcs//lib/diff/lcs.rb#51
59
- module Diff::LCS
60
- # Returns the difference set between +self+ and +other+. See Diff::LCS#diff.
61
- #
62
- # source://diff-lcs//lib/diff/lcs.rb#75
63
- def diff(other, callbacks = T.unsafe(nil), &block); end
64
-
65
- # Returns an Array containing the longest common subsequence(s) between
66
- # +self+ and +other+. See Diff::LCS#lcs.
67
- #
68
- # lcs = seq1.lcs(seq2)
69
- #
70
- # A note when using objects: Diff::LCS only works properly when each object
71
- # can be used as a key in a Hash, which typically means that the objects must
72
- # implement Object#eql? in a way that two identical values compare
73
- # identically for key purposes. That is:
74
- #
75
- # O.new('a').eql?(O.new('a')) == true
76
- #
77
- # source://diff-lcs//lib/diff/lcs.rb#70
78
- def lcs(other, &block); end
79
-
80
- # Attempts to patch +self+ with the provided +patchset+. A new sequence based
81
- # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Attempts
82
- # to autodiscover the direction of the patch.
83
- #
84
- # source://diff-lcs//lib/diff/lcs.rb#101
85
- def patch(patchset); end
86
-
87
- # Attempts to patch +self+ with the provided +patchset+. A new sequence based
88
- # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Does no
89
- # patch direction autodiscovery.
90
- #
91
- # source://diff-lcs//lib/diff/lcs.rb#109
92
- def patch!(patchset); end
93
-
94
- # Attempts to patch +self+ with the provided +patchset+, using #patch!. If
95
- # the sequence this is used on supports #replace, the value of +self+ will be
96
- # replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.
97
- #
98
- # source://diff-lcs//lib/diff/lcs.rb#123
99
- def patch_me(patchset); end
100
-
101
- # Returns the balanced ("side-by-side") difference set between +self+ and
102
- # +other+. See Diff::LCS#sdiff.
103
- #
104
- # source://diff-lcs//lib/diff/lcs.rb#81
105
- def sdiff(other, callbacks = T.unsafe(nil), &block); end
106
-
107
- # Traverses the discovered longest common subsequences between +self+ and
108
- # +other+ using the alternate, balanced algorithm. See
109
- # Diff::LCS#traverse_balanced.
110
- #
111
- # source://diff-lcs//lib/diff/lcs.rb#94
112
- def traverse_balanced(other, callbacks = T.unsafe(nil), &block); end
113
-
114
- # Traverses the discovered longest common subsequences between +self+ and
115
- # +other+. See Diff::LCS#traverse_sequences.
116
- #
117
- # source://diff-lcs//lib/diff/lcs.rb#87
118
- def traverse_sequences(other, callbacks = T.unsafe(nil), &block); end
119
-
120
- # Attempts to patch +self+ with the provided +patchset+. A new sequence based
121
- # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Attempts
122
- # to autodiscover the direction of the patch.
123
- #
124
- # source://diff-lcs//lib/diff/lcs.rb#101
125
- def unpatch(patchset); end
126
-
127
- # Attempts to unpatch +self+ with the provided +patchset+. A new sequence
128
- # based on +self+ and the +patchset+ will be created. See Diff::LCS#unpatch.
129
- # Does no patch direction autodiscovery.
130
- #
131
- # source://diff-lcs//lib/diff/lcs.rb#116
132
- def unpatch!(patchset); end
133
-
134
- # Attempts to unpatch +self+ with the provided +patchset+, using #unpatch!.
135
- # If the sequence this is used on supports #replace, the value of +self+ will
136
- # be replaced. See Diff::LCS#unpatch. Does no patch direction autodiscovery.
137
- #
138
- # source://diff-lcs//lib/diff/lcs.rb#134
139
- def unpatch_me(patchset); end
140
-
141
- class << self
142
- # :yields: seq1[i] for each matched
143
- #
144
- # source://diff-lcs//lib/diff/lcs.rb#144
145
- def LCS(seq1, seq2, &block); end
146
-
147
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#52
148
- def callbacks_for(callbacks); end
149
-
150
- # #diff computes the smallest set of additions and deletions necessary to
151
- # turn the first sequence into the second, and returns a description of these
152
- # changes.
153
- #
154
- # See Diff::LCS::DiffCallbacks for the default behaviour. An alternate
155
- # behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
156
- # Class argument is provided for +callbacks+, #diff will attempt to
157
- # initialise it. If the +callbacks+ object (possibly initialised) responds to
158
- # #finish, it will be called.
159
- #
160
- # source://diff-lcs//lib/diff/lcs.rb#168
161
- def diff(seq1, seq2, callbacks = T.unsafe(nil), &block); end
162
-
163
- # :yields: seq1[i] for each matched
164
- #
165
- # source://diff-lcs//lib/diff/lcs.rb#144
166
- def lcs(seq1, seq2, &block); end
167
-
168
- # Applies a +patchset+ to the sequence +src+ according to the +direction+
169
- # (<tt>:patch</tt> or <tt>:unpatch</tt>), producing a new sequence.
170
- #
171
- # If the +direction+ is not specified, Diff::LCS::patch will attempt to
172
- # discover the direction of the +patchset+.
173
- #
174
- # A +patchset+ can be considered to apply forward (<tt>:patch</tt>) if the
175
- # following expression is true:
176
- #
177
- # patch(s1, diff(s1, s2)) -> s2
178
- #
179
- # A +patchset+ can be considered to apply backward (<tt>:unpatch</tt>) if the
180
- # following expression is true:
181
- #
182
- # patch(s2, diff(s1, s2)) -> s1
183
- #
184
- # If the +patchset+ contains no changes, the +src+ value will be returned as
185
- # either <tt>src.dup</tt> or +src+. A +patchset+ can be deemed as having no
186
- # changes if the following predicate returns true:
187
- #
188
- # patchset.empty? or
189
- # patchset.flatten(1).all? { |change| change.unchanged? }
190
- #
191
- # === Patchsets
192
- #
193
- # A +patchset+ is always an enumerable sequence of changes, hunks of changes,
194
- # or a mix of the two. A hunk of changes is an enumerable sequence of
195
- # changes:
196
- #
197
- # [ # patchset
198
- # # change
199
- # [ # hunk
200
- # # change
201
- # ]
202
- # ]
203
- #
204
- # The +patch+ method accepts <tt>patchset</tt>s that are enumerable sequences
205
- # containing either Diff::LCS::Change objects (or a subclass) or the array
206
- # representations of those objects. Prior to application, array
207
- # representations of Diff::LCS::Change objects will be reified.
208
- #
209
- # source://diff-lcs//lib/diff/lcs.rb#626
210
- def patch(src, patchset, direction = T.unsafe(nil)); end
211
-
212
- # Given a set of patchset, convert the current version to the next version.
213
- # Does no auto-discovery.
214
- #
215
- # source://diff-lcs//lib/diff/lcs.rb#736
216
- def patch!(src, patchset); end
217
-
218
- # #sdiff computes all necessary components to show two sequences and their
219
- # minimized differences side by side, just like the Unix utility
220
- # <em>sdiff</em> does:
221
- #
222
- # old < -
223
- # same same
224
- # before | after
225
- # - > new
226
- #
227
- # See Diff::LCS::SDiffCallbacks for the default behaviour. An alternate
228
- # behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
229
- # Class argument is provided for +callbacks+, #diff will attempt to
230
- # initialise it. If the +callbacks+ object (possibly initialised) responds to
231
- # #finish, it will be called.
232
- #
233
- # Each element of a returned array is a Diff::LCS::ContextChange object,
234
- # which can be implicitly converted to an array.
235
- #
236
- # Diff::LCS.sdiff(a, b).each do |action, (old_pos, old_element), (new_pos, new_element)|
237
- # case action
238
- # when '!'
239
- # # replace
240
- # when '-'
241
- # # delete
242
- # when '+'
243
- # # insert
244
- # end
245
- # end
246
- #
247
- # source://diff-lcs//lib/diff/lcs.rb#200
248
- def sdiff(seq1, seq2, callbacks = T.unsafe(nil), &block); end
249
-
250
- # #traverse_balanced is an alternative to #traverse_sequences. It uses a
251
- # different algorithm to iterate through the entries in the computed longest
252
- # common subsequence. Instead of viewing the changes as insertions or
253
- # deletions from one of the sequences, #traverse_balanced will report
254
- # <em>changes</em> between the sequences.
255
- #
256
- # The arguments to #traverse_balanced are the two sequences to traverse and a
257
- # callback object, like this:
258
- #
259
- # traverse_balanced(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
260
- #
261
- # #sdiff is implemented with #traverse_balanced.
262
- #
263
- # == Callback Methods
264
- #
265
- # Optional callback methods are <em>emphasized</em>.
266
- #
267
- # callbacks#match:: Called when +a+ and +b+ are pointing to
268
- # common elements in +A+ and +B+.
269
- # callbacks#discard_a:: Called when +a+ is pointing to an
270
- # element not in +B+.
271
- # callbacks#discard_b:: Called when +b+ is pointing to an
272
- # element not in +A+.
273
- # <em>callbacks#change</em>:: Called when +a+ and +b+ are pointing to
274
- # the same relative position, but
275
- # <tt>A[a]</tt> and <tt>B[b]</tt> are not
276
- # the same; a <em>change</em> has
277
- # occurred.
278
- #
279
- # #traverse_balanced might be a bit slower than #traverse_sequences,
280
- # noticable only while processing huge amounts of data.
281
- #
282
- # == Algorithm
283
- #
284
- # a---+
285
- # v
286
- # A = a b c e h j l m n p
287
- # B = b c d e f j k l m r s t
288
- # ^
289
- # b---+
290
- #
291
- # === Matches
292
- #
293
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
294
- # and +B+, the arrows will initially point to the first elements of their
295
- # respective sequences. #traverse_sequences will advance the arrows through
296
- # the sequences one element at a time, calling a method on the user-specified
297
- # callback object before each advance. It will advance the arrows in such a
298
- # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
299
- # both equal and part of the longest common subsequence, there will be some
300
- # moment during the execution of #traverse_sequences when arrow +a+ is
301
- # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
302
- # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
303
- # then it will advance both arrows.
304
- #
305
- # === Discards
306
- #
307
- # Otherwise, one of the arrows is pointing to an element of its sequence that
308
- # is not part of the longest common subsequence. #traverse_sequences will
309
- # advance that arrow and will call <tt>callbacks#discard_a</tt> or
310
- # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced.
311
- #
312
- # === Changes
313
- #
314
- # If both +a+ and +b+ point to elements that are not part of the longest
315
- # common subsequence, then #traverse_sequences will try to call
316
- # <tt>callbacks#change</tt> and advance both arrows. If
317
- # <tt>callbacks#change</tt> is not implemented, then
318
- # <tt>callbacks#discard_a</tt> and <tt>callbacks#discard_b</tt> will be
319
- # called in turn.
320
- #
321
- # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>,
322
- # <tt>callbacks#discard_b</tt>, and <tt>callbacks#change</tt> are invoked
323
- # with an event comprising the action ("=", "+", "-", or "!", respectively),
324
- # the indicies +i+ and +j+, and the elements <tt>A[i]</tt> and <tt>B[j]</tt>.
325
- # Return values are discarded by #traverse_balanced.
326
- #
327
- # === Context
328
- #
329
- # Note that +i+ and +j+ may not be the same index position, even if +a+ and
330
- # +b+ are considered to be pointing to matching or changed elements.
331
- #
332
- # source://diff-lcs//lib/diff/lcs.rb#475
333
- def traverse_balanced(seq1, seq2, callbacks = T.unsafe(nil)); end
334
-
335
- # #traverse_sequences is the most general facility provided by this module;
336
- # #diff and #lcs are implemented as calls to it.
337
- #
338
- # The arguments to #traverse_sequences are the two sequences to traverse, and
339
- # a callback object, like this:
340
- #
341
- # traverse_sequences(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
342
- #
343
- # == Callback Methods
344
- #
345
- # Optional callback methods are <em>emphasized</em>.
346
- #
347
- # callbacks#match:: Called when +a+ and +b+ are pointing to
348
- # common elements in +A+ and +B+.
349
- # callbacks#discard_a:: Called when +a+ is pointing to an
350
- # element not in +B+.
351
- # callbacks#discard_b:: Called when +b+ is pointing to an
352
- # element not in +A+.
353
- # <em>callbacks#finished_a</em>:: Called when +a+ has reached the end of
354
- # sequence +A+.
355
- # <em>callbacks#finished_b</em>:: Called when +b+ has reached the end of
356
- # sequence +B+.
357
- #
358
- # == Algorithm
359
- #
360
- # a---+
361
- # v
362
- # A = a b c e h j l m n p
363
- # B = b c d e f j k l m r s t
364
- # ^
365
- # b---+
366
- #
367
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
368
- # and +B+, the arrows will initially point to the first elements of their
369
- # respective sequences. #traverse_sequences will advance the arrows through
370
- # the sequences one element at a time, calling a method on the user-specified
371
- # callback object before each advance. It will advance the arrows in such a
372
- # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
373
- # both equal and part of the longest common subsequence, there will be some
374
- # moment during the execution of #traverse_sequences when arrow +a+ is
375
- # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
376
- # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
377
- # then it will advance both arrows.
378
- #
379
- # Otherwise, one of the arrows is pointing to an element of its sequence that
380
- # is not part of the longest common subsequence. #traverse_sequences will
381
- # advance that arrow and will call <tt>callbacks#discard_a</tt> or
382
- # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced. If both
383
- # arrows point to elements that are not part of the longest common
384
- # subsequence, then #traverse_sequences will advance arrow +a+ and call the
385
- # appropriate callback, then it will advance arrow +b+ and call the appropriate
386
- # callback.
387
- #
388
- # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>, and
389
- # <tt>callbacks#discard_b</tt> are invoked with an event comprising the
390
- # action ("=", "+", or "-", respectively), the indicies +i+ and +j+, and the
391
- # elements <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are discarded by
392
- # #traverse_sequences.
393
- #
394
- # === End of Sequences
395
- #
396
- # If arrow +a+ reaches the end of its sequence before arrow +b+ does,
397
- # #traverse_sequence will try to call <tt>callbacks#finished_a</tt> with the
398
- # last index and element of +A+ (<tt>A[-1]</tt>) and the current index and
399
- # element of +B+ (<tt>B[j]</tt>). If <tt>callbacks#finished_a</tt> does not
400
- # exist, then <tt>callbacks#discard_b</tt> will be called on each element of
401
- # +B+ until the end of the sequence is reached (the call will be done with
402
- # <tt>A[-1]</tt> and <tt>B[j]</tt> for each element).
403
- #
404
- # If +b+ reaches the end of +B+ before +a+ reaches the end of +A+,
405
- # <tt>callbacks#finished_b</tt> will be called with the current index and
406
- # element of +A+ (<tt>A[i]</tt>) and the last index and element of +B+
407
- # (<tt>A[-1]</tt>). Again, if <tt>callbacks#finished_b</tt> does not exist on
408
- # the callback object, then <tt>callbacks#discard_a</tt> will be called on
409
- # each element of +A+ until the end of the sequence is reached (<tt>A[i]</tt>
410
- # and <tt>B[-1]</tt>).
411
- #
412
- # There is a chance that one additional <tt>callbacks#discard_a</tt> or
413
- # <tt>callbacks#discard_b</tt> will be called after the end of the sequence
414
- # is reached, if +a+ has not yet reached the end of +A+ or +b+ has not yet
415
- # reached the end of +B+.
416
- #
417
- # source://diff-lcs//lib/diff/lcs.rb#285
418
- def traverse_sequences(seq1, seq2, callbacks = T.unsafe(nil)); end
419
-
420
- # Given a set of patchset, convert the current version to the prior version.
421
- # Does no auto-discovery.
422
- #
423
- # source://diff-lcs//lib/diff/lcs.rb#730
424
- def unpatch!(src, patchset); end
425
-
426
- private
427
-
428
- # source://diff-lcs//lib/diff/lcs/internals.rb#4
429
- def diff_traversal(method, seq1, seq2, callbacks, &block); end
430
- end
431
- end
432
-
433
- # An alias for DefaultCallbacks that is used in
434
- # Diff::LCS#traverse_balanced.
435
- #
436
- # Diff::LCS.LCS(seq1, seq2, Diff::LCS::BalancedCallbacks)
437
- #
438
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#50
439
- Diff::LCS::BalancedCallbacks = Diff::LCS::DefaultCallbacks
440
-
441
- # Represents a simplistic (non-contextual) change. Represents the removal or
442
- # addition of an element from either the old or the new sequenced
443
- # enumerable.
444
- #
445
- # source://diff-lcs//lib/diff/lcs/change.rb#6
446
- class Diff::LCS::Change
447
- include ::Comparable
448
-
449
- # @return [Change] a new instance of Change
450
- #
451
- # source://diff-lcs//lib/diff/lcs/change.rb#27
452
- def initialize(*args); end
453
-
454
- # source://diff-lcs//lib/diff/lcs/change.rb#65
455
- def <=>(other); end
456
-
457
- # source://diff-lcs//lib/diff/lcs/change.rb#58
458
- def ==(other); end
459
-
460
- # Returns the action this Change represents.
461
- #
462
- # source://diff-lcs//lib/diff/lcs/change.rb#20
463
- def action; end
464
-
465
- # @return [Boolean]
466
- #
467
- # source://diff-lcs//lib/diff/lcs/change.rb#72
468
- def adding?; end
469
-
470
- # @return [Boolean]
471
- #
472
- # source://diff-lcs//lib/diff/lcs/change.rb#84
473
- def changed?; end
474
-
475
- # @return [Boolean]
476
- #
477
- # source://diff-lcs//lib/diff/lcs/change.rb#76
478
- def deleting?; end
479
-
480
- # Returns the sequence element of the Change.
481
- #
482
- # source://diff-lcs//lib/diff/lcs/change.rb#25
483
- def element; end
484
-
485
- # @return [Boolean]
486
- #
487
- # source://diff-lcs//lib/diff/lcs/change.rb#88
488
- def finished_a?; end
489
-
490
- # @return [Boolean]
491
- #
492
- # source://diff-lcs//lib/diff/lcs/change.rb#92
493
- def finished_b?; end
494
-
495
- # source://diff-lcs//lib/diff/lcs/change.rb#34
496
- def inspect(*_args); end
497
-
498
- # Returns the position of the Change.
499
- #
500
- # source://diff-lcs//lib/diff/lcs/change.rb#23
501
- def position; end
502
-
503
- # source://diff-lcs//lib/diff/lcs/change.rb#38
504
- def to_a; end
505
-
506
- # source://diff-lcs//lib/diff/lcs/change.rb#38
507
- def to_ary; end
508
-
509
- # @return [Boolean]
510
- #
511
- # source://diff-lcs//lib/diff/lcs/change.rb#80
512
- def unchanged?; end
513
-
514
- class << self
515
- # source://diff-lcs//lib/diff/lcs/change.rb#44
516
- def from_a(arr); end
517
-
518
- # @return [Boolean]
519
- #
520
- # source://diff-lcs//lib/diff/lcs/change.rb#15
521
- def valid_action?(action); end
522
- end
523
- end
524
-
525
- # source://diff-lcs//lib/diff/lcs/change.rb#7
526
- Diff::LCS::Change::IntClass = Integer
527
-
528
- # The only actions valid for changes are '+' (add), '-' (delete), '='
529
- # (no change), '!' (changed), '<' (tail changes from first sequence), or
530
- # '>' (tail changes from second sequence). The last two ('<>') are only
531
- # found with Diff::LCS::diff and Diff::LCS::sdiff.
532
- #
533
- # source://diff-lcs//lib/diff/lcs/change.rb#13
534
- Diff::LCS::Change::VALID_ACTIONS = T.let(T.unsafe(nil), Array)
535
-
536
- # Represents a contextual change. Contains the position and values of the
537
- # elements in the old and the new sequenced enumerables as well as the action
538
- # taken.
539
- #
540
- # source://diff-lcs//lib/diff/lcs/change.rb#101
541
- class Diff::LCS::ContextChange < ::Diff::LCS::Change
542
- # @return [ContextChange] a new instance of ContextChange
543
- #
544
- # source://diff-lcs//lib/diff/lcs/change.rb#114
545
- def initialize(*args); end
546
-
547
- # source://diff-lcs//lib/diff/lcs/change.rb#166
548
- def <=>(other); end
549
-
550
- # source://diff-lcs//lib/diff/lcs/change.rb#157
551
- def ==(other); end
552
-
553
- # Returns the new element being changed.
554
- #
555
- # source://diff-lcs//lib/diff/lcs/change.rb#112
556
- def new_element; end
557
-
558
- # Returns the new position being changed.
559
- #
560
- # source://diff-lcs//lib/diff/lcs/change.rb#108
561
- def new_position; end
562
-
563
- # Returns the old element being changed.
564
- #
565
- # source://diff-lcs//lib/diff/lcs/change.rb#110
566
- def old_element; end
567
-
568
- # Returns the old position being changed.
569
- #
570
- # source://diff-lcs//lib/diff/lcs/change.rb#106
571
- def old_position; end
572
-
573
- # source://diff-lcs//lib/diff/lcs/change.rb#122
574
- def to_a; end
575
-
576
- # source://diff-lcs//lib/diff/lcs/change.rb#122
577
- def to_ary; end
578
-
579
- class << self
580
- # source://diff-lcs//lib/diff/lcs/change.rb#132
581
- def from_a(arr); end
582
-
583
- # Simplifies a context change for use in some diff callbacks. '<' actions
584
- # are converted to '-' and '>' actions are converted to '+'.
585
- #
586
- # source://diff-lcs//lib/diff/lcs/change.rb#138
587
- def simplify(event); end
588
- end
589
- end
590
-
591
- # This will produce a compound array of contextual diff change objects. Each
592
- # element in the #diffs array is a "hunk" array, where each element in each
593
- # "hunk" array is a single change. Each change is a Diff::LCS::ContextChange
594
- # that contains both the old index and new index values for the change. The
595
- # "hunk" provides the full context for the changes. Both old and new objects
596
- # will be presented for changed objects. +nil+ will be substituted for a
597
- # discarded object.
598
- #
599
- # seq1 = %w(a b c e h j l m n p)
600
- # seq2 = %w(b c d e f j k l m r s t)
601
- #
602
- # diffs = Diff::LCS.diff(seq1, seq2, Diff::LCS::ContextDiffCallbacks)
603
- # # This example shows a simplified array format.
604
- # # [ [ [ '-', [ 0, 'a' ], [ 0, nil ] ] ], # 1
605
- # # [ [ '+', [ 3, nil ], [ 2, 'd' ] ] ], # 2
606
- # # [ [ '-', [ 4, 'h' ], [ 4, nil ] ], # 3
607
- # # [ '+', [ 5, nil ], [ 4, 'f' ] ] ],
608
- # # [ [ '+', [ 6, nil ], [ 6, 'k' ] ] ], # 4
609
- # # [ [ '-', [ 8, 'n' ], [ 9, nil ] ], # 5
610
- # # [ '+', [ 9, nil ], [ 9, 'r' ] ],
611
- # # [ '-', [ 9, 'p' ], [ 10, nil ] ],
612
- # # [ '+', [ 10, nil ], [ 10, 's' ] ],
613
- # # [ '+', [ 10, nil ], [ 11, 't' ] ] ] ]
614
- #
615
- # The five hunks shown are comprised of individual changes; if there is a
616
- # related set of changes, they are still shown individually.
617
- #
618
- # This callback can also be used with Diff::LCS#sdiff, which will produce
619
- # results like:
620
- #
621
- # diffs = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextCallbacks)
622
- # # This example shows a simplified array format.
623
- # # [ [ [ "-", [ 0, "a" ], [ 0, nil ] ] ], # 1
624
- # # [ [ "+", [ 3, nil ], [ 2, "d" ] ] ], # 2
625
- # # [ [ "!", [ 4, "h" ], [ 4, "f" ] ] ], # 3
626
- # # [ [ "+", [ 6, nil ], [ 6, "k" ] ] ], # 4
627
- # # [ [ "!", [ 8, "n" ], [ 9, "r" ] ], # 5
628
- # # [ "!", [ 9, "p" ], [ 10, "s" ] ],
629
- # # [ "+", [ 10, nil ], [ 11, "t" ] ] ] ]
630
- #
631
- # The five hunks are still present, but are significantly shorter in total
632
- # presentation, because changed items are shown as changes ("!") instead of
633
- # potentially "mismatched" pairs of additions and deletions.
634
- #
635
- # The result of this operation is similar to that of
636
- # Diff::LCS::SDiffCallbacks. They may be compared as:
637
- #
638
- # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
639
- # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
640
- #
641
- # s == c # -> true
642
- #
643
- # === Use
644
- #
645
- # This callback object must be initialised and can be used by the
646
- # Diff::LCS#diff or Diff::LCS#sdiff methods.
647
- #
648
- # cbo = Diff::LCS::ContextDiffCallbacks.new
649
- # Diff::LCS.LCS(seq1, seq2, cbo)
650
- # cbo.finish
651
- #
652
- # Note that the call to #finish is absolutely necessary, or the last set of
653
- # changes will not be visible. Alternatively, can be used as:
654
- #
655
- # cbo = Diff::LCS::ContextDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
656
- #
657
- # The necessary #finish call will be made.
658
- #
659
- # === Simplified Array Format
660
- #
661
- # The simplified array format used in the example above can be obtained
662
- # with:
663
- #
664
- # require 'pp'
665
- # pp diffs.map { |e| e.map { |f| f.to_a } }
666
- #
667
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#225
668
- class Diff::LCS::ContextDiffCallbacks < ::Diff::LCS::DiffCallbacks
669
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#234
670
- def change(event); end
671
-
672
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#226
673
- def discard_a(event); end
674
-
675
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#230
676
- def discard_b(event); end
677
- end
678
-
679
- # This callback object implements the default set of callback events,
680
- # which only returns the event itself. Note that #finished_a and
681
- # #finished_b are not implemented -- I haven't yet figured out where they
682
- # would be useful.
683
- #
684
- # Note that this is intended to be called as is, e.g.,
685
- #
686
- # Diff::LCS.LCS(seq1, seq2, Diff::LCS::DefaultCallbacks)
687
- #
688
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#14
689
- class Diff::LCS::DefaultCallbacks
690
- class << self
691
- # Called when both the old and new values have changed.
692
- #
693
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#32
694
- def change(event); end
695
-
696
- # Called when the old value is discarded in favour of the new value.
697
- #
698
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#22
699
- def discard_a(event); end
700
-
701
- # Called when the new value is discarded in favour of the old value.
702
- #
703
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#27
704
- def discard_b(event); end
705
-
706
- # Called when two items match.
707
- #
708
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#17
709
- def match(event); end
710
-
711
- private
712
-
713
- def new(*_arg0); end
714
- end
715
- end
716
-
717
- # This will produce a compound array of simple diff change objects. Each
718
- # element in the #diffs array is a +hunk+ or +hunk+ array, where each
719
- # element in each +hunk+ array is a single Change object representing the
720
- # addition or removal of a single element from one of the two tested
721
- # sequences. The +hunk+ provides the full context for the changes.
722
- #
723
- # diffs = Diff::LCS.diff(seq1, seq2)
724
- # # This example shows a simplified array format.
725
- # # [ [ [ '-', 0, 'a' ] ], # 1
726
- # # [ [ '+', 2, 'd' ] ], # 2
727
- # # [ [ '-', 4, 'h' ], # 3
728
- # # [ '+', 4, 'f' ] ],
729
- # # [ [ '+', 6, 'k' ] ], # 4
730
- # # [ [ '-', 8, 'n' ], # 5
731
- # # [ '-', 9, 'p' ],
732
- # # [ '+', 9, 'r' ],
733
- # # [ '+', 10, 's' ],
734
- # # [ '+', 11, 't' ] ] ]
735
- #
736
- # There are five hunks here. The first hunk says that the +a+ at position 0
737
- # of the first sequence should be deleted (<tt>'-'</tt>). The second hunk
738
- # says that the +d+ at position 2 of the second sequence should be inserted
739
- # (<tt>'+'</tt>). The third hunk says that the +h+ at position 4 of the
740
- # first sequence should be removed and replaced with the +f+ from position 4
741
- # of the second sequence. The other two hunks are described similarly.
742
- #
743
- # === Use
744
- #
745
- # This callback object must be initialised and is used by the Diff::LCS#diff
746
- # method.
747
- #
748
- # cbo = Diff::LCS::DiffCallbacks.new
749
- # Diff::LCS.LCS(seq1, seq2, cbo)
750
- # cbo.finish
751
- #
752
- # Note that the call to #finish is absolutely necessary, or the last set of
753
- # changes will not be visible. Alternatively, can be used as:
754
- #
755
- # cbo = Diff::LCS::DiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
756
- #
757
- # The necessary #finish call will be made.
758
- #
759
- # === Simplified Array Format
760
- #
761
- # The simplified array format used in the example above can be obtained
762
- # with:
763
- #
764
- # require 'pp'
765
- # pp diffs.map { |e| e.map { |f| f.to_a } }
766
- #
767
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#108
768
- class Diff::LCS::DiffCallbacks
769
- # :yields: self
770
- #
771
- # @return [DiffCallbacks] a new instance of DiffCallbacks
772
- #
773
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#112
774
- def initialize; end
775
-
776
- # Returns the difference set collected during the diff process.
777
- #
778
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#110
779
- def diffs; end
780
-
781
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#135
782
- def discard_a(event); end
783
-
784
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#139
785
- def discard_b(event); end
786
-
787
- # Finalizes the diff process. If an unprocessed hunk still exists, then it
788
- # is appended to the diff list.
789
- #
790
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#127
791
- def finish; end
792
-
793
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#131
794
- def match(_event); end
795
-
796
- private
797
-
798
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#143
799
- def finish_hunk; end
800
- end
801
-
802
- # source://diff-lcs//lib/diff/lcs/internals.rb#29
803
- module Diff::LCS::Internals
804
- class << self
805
- # This method will analyze the provided patchset to provide a single-pass
806
- # normalization (conversion of the array form of Diff::LCS::Change objects to
807
- # the object form of same) and detection of whether the patchset represents
808
- # changes to be made.
809
- #
810
- # source://diff-lcs//lib/diff/lcs/internals.rb#102
811
- def analyze_patchset(patchset, depth = T.unsafe(nil)); end
812
-
813
- # Examine the patchset and the source to see in which direction the
814
- # patch should be applied.
815
- #
816
- # WARNING: By default, this examines the whole patch, so this could take
817
- # some time. This also works better with Diff::LCS::ContextChange or
818
- # Diff::LCS::Change as its source, as an array will cause the creation
819
- # of one of the above.
820
- #
821
- # source://diff-lcs//lib/diff/lcs/internals.rb#147
822
- def intuit_diff_direction(src, patchset, limit = T.unsafe(nil)); end
823
-
824
- # Compute the longest common subsequence between the sequenced
825
- # Enumerables +a+ and +b+. The result is an array whose contents is such
826
- # that
827
- #
828
- # result = Diff::LCS::Internals.lcs(a, b)
829
- # result.each_with_index do |e, i|
830
- # assert_equal(a[i], b[e]) unless e.nil?
831
- # end
832
- #
833
- # source://diff-lcs//lib/diff/lcs/internals.rb#41
834
- def lcs(a, b); end
835
-
836
- private
837
-
838
- # If +vector+ maps the matching elements of another collection onto this
839
- # Enumerable, compute the inverse of +vector+ that maps this Enumerable
840
- # onto the collection. (Currently unused.)
841
- #
842
- # source://diff-lcs//lib/diff/lcs/internals.rb#286
843
- def inverse_vector(a, vector); end
844
-
845
- # Returns a hash mapping each element of an Enumerable to the set of
846
- # positions it occupies in the Enumerable, optionally restricted to the
847
- # elements specified in the range of indexes specified by +interval+.
848
- #
849
- # source://diff-lcs//lib/diff/lcs/internals.rb#298
850
- def position_hash(enum, interval); end
851
-
852
- # Find the place at which +value+ would normally be inserted into the
853
- # Enumerable. If that place is already occupied by +value+, do nothing
854
- # and return +nil+. If the place does not exist (i.e., it is off the end
855
- # of the Enumerable), add it to the end. Otherwise, replace the element
856
- # at that point with +value+. It is assumed that the Enumerable's values
857
- # are numeric.
858
- #
859
- # This operation preserves the sort order.
860
- #
861
- # source://diff-lcs//lib/diff/lcs/internals.rb#252
862
- def replace_next_larger(enum, value, last_index = T.unsafe(nil)); end
863
- end
864
- end
865
-
866
- # This will produce a simple array of diff change objects. Each element in
867
- # the #diffs array is a single ContextChange. In the set of #diffs provided
868
- # by SDiffCallbacks, both old and new objects will be presented for both
869
- # changed <strong>and unchanged</strong> objects. +nil+ will be substituted
870
- # for a discarded object.
871
- #
872
- # The diffset produced by this callback, when provided to Diff::LCS#sdiff,
873
- # will compute and display the necessary components to show two sequences
874
- # and their minimized differences side by side, just like the Unix utility
875
- # +sdiff+.
876
- #
877
- # same same
878
- # before | after
879
- # old < -
880
- # - > new
881
- #
882
- # seq1 = %w(a b c e h j l m n p)
883
- # seq2 = %w(b c d e f j k l m r s t)
884
- #
885
- # diffs = Diff::LCS.sdiff(seq1, seq2)
886
- # # This example shows a simplified array format.
887
- # # [ [ "-", [ 0, "a"], [ 0, nil ] ],
888
- # # [ "=", [ 1, "b"], [ 0, "b" ] ],
889
- # # [ "=", [ 2, "c"], [ 1, "c" ] ],
890
- # # [ "+", [ 3, nil], [ 2, "d" ] ],
891
- # # [ "=", [ 3, "e"], [ 3, "e" ] ],
892
- # # [ "!", [ 4, "h"], [ 4, "f" ] ],
893
- # # [ "=", [ 5, "j"], [ 5, "j" ] ],
894
- # # [ "+", [ 6, nil], [ 6, "k" ] ],
895
- # # [ "=", [ 6, "l"], [ 7, "l" ] ],
896
- # # [ "=", [ 7, "m"], [ 8, "m" ] ],
897
- # # [ "!", [ 8, "n"], [ 9, "r" ] ],
898
- # # [ "!", [ 9, "p"], [ 10, "s" ] ],
899
- # # [ "+", [ 10, nil], [ 11, "t" ] ] ]
900
- #
901
- # The result of this operation is similar to that of
902
- # Diff::LCS::ContextDiffCallbacks. They may be compared as:
903
- #
904
- # s = Diff::LCS.sdiff(seq1, seq2).reject { |e| e.action == "=" }
905
- # c = Diff::LCS.sdiff(seq1, seq2, Diff::LCS::ContextDiffCallbacks).flatten(1)
906
- #
907
- # s == c # -> true
908
- #
909
- # === Use
910
- #
911
- # This callback object must be initialised and is used by the Diff::LCS#sdiff
912
- # method.
913
- #
914
- # cbo = Diff::LCS::SDiffCallbacks.new
915
- # Diff::LCS.LCS(seq1, seq2, cbo)
916
- #
917
- # As with the other initialisable callback objects,
918
- # Diff::LCS::SDiffCallbacks can be initialised with a block. As there is no
919
- # "fininishing" to be done, this has no effect on the state of the object.
920
- #
921
- # cbo = Diff::LCS::SDiffCallbacks.new { |tcbo| Diff::LCS.LCS(seq1, seq2, tcbo) }
922
- #
923
- # === Simplified Array Format
924
- #
925
- # The simplified array format used in the example above can be obtained
926
- # with:
927
- #
928
- # require 'pp'
929
- # pp diffs.map { |e| e.to_a }
930
- #
931
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#303
932
- class Diff::LCS::SDiffCallbacks
933
- # :yields: self
934
- #
935
- # @return [SDiffCallbacks] a new instance of SDiffCallbacks
936
- # @yield [_self]
937
- # @yieldparam _self [Diff::LCS::SDiffCallbacks] the object that the method was called on
938
- #
939
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#307
940
- def initialize; end
941
-
942
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#324
943
- def change(event); end
944
-
945
- # Returns the difference set collected during the diff process.
946
- #
947
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#305
948
- def diffs; end
949
-
950
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#316
951
- def discard_a(event); end
952
-
953
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#320
954
- def discard_b(event); end
955
-
956
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#312
957
- def match(event); end
958
- end
959
-
960
- # An alias for DefaultCallbacks that is used in
961
- # Diff::LCS#traverse_sequences.
962
- #
963
- # Diff::LCS.LCS(seq1, seq2, Diff::LCS::SequenceCallbacks)
964
- #
965
- # source://diff-lcs//lib/diff/lcs/callbacks.rb#44
966
- Diff::LCS::SequenceCallbacks = Diff::LCS::DefaultCallbacks
967
-
968
- # source://diff-lcs//lib/diff/lcs.rb#52
969
- Diff::LCS::VERSION = T.let(T.unsafe(nil), String)