deck_of_cards_handler 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/{deck_of_cards → deck_of_cards_handler}/packet/packet.rb +3 -3
- data/lib/deck_of_cards_handler/version.rb +5 -0
- data/lib/deck_of_cards_handler.rb +6 -0
- data/sig/deck_of_cards.rbs +1 -1
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +586 -0
- data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
- data/sorbet/rbi/gems/date@3.4.1.rbi +403 -0
- data/sorbet/rbi/gems/erb@5.0.3.rbi +846 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +157 -0
- data/sorbet/rbi/gems/io-console@0.8.1.rbi +9 -0
- data/sorbet/rbi/gems/json@2.15.1.rbi +2326 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +119 -0
- data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
- data/sorbet/rbi/gems/minitest@5.25.5.rbi +1547 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +177 -0
- data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
- data/sorbet/rbi/gems/parser@3.3.9.0.rbi +5537 -0
- data/sorbet/rbi/gems/pp@0.6.3.rbi +376 -0
- data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
- data/sorbet/rbi/gems/prism@1.5.1.rbi +42107 -0
- data/sorbet/rbi/gems/psych@5.2.6.rbi +2542 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +168 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.3.0.rbi +3039 -0
- data/sorbet/rbi/gems/rbi@0.3.6.rbi +5162 -0
- data/sorbet/rbi/gems/rbs@4.0.0.dev.4.rbi +7895 -0
- data/sorbet/rbi/gems/rdoc@6.15.0.rbi +13031 -0
- data/sorbet/rbi/gems/regexp_parser@2.11.3.rbi +3883 -0
- data/sorbet/rbi/gems/reline@0.6.2.rbi +2998 -0
- data/sorbet/rbi/gems/require-hooks@0.2.2.rbi +110 -0
- data/sorbet/rbi/gems/rexml@3.4.4.rbi +5250 -0
- data/sorbet/rbi/gems/rubocop-ast@1.47.1.rbi +7435 -0
- data/sorbet/rbi/gems/rubocop@1.81.1.rbi +63854 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/spoom@1.7.6.rbi +5832 -0
- data/sorbet/rbi/gems/stringio@3.1.7.rbi +9 -0
- data/sorbet/rbi/gems/tapioca@0.17.7.rbi +3505 -0
- data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
- data/sorbet/rbi/gems/tsort@0.2.0.rbi +393 -0
- data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +132 -0
- data/sorbet/rbi/gems/unicode-emoji@4.1.0.rbi +251 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +430 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18419 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +61 -20
- data/lib/deck_of_cards/version.rb +0 -5
- data/lib/deck_of_cards.rb +0 -6
- /data/lib/{deck_of_cards → deck_of_cards_handler}/card/card.rb +0 -0
- /data/lib/{deck_of_cards → deck_of_cards_handler}/card.rb +0 -0
- /data/lib/{deck_of_cards → deck_of_cards_handler}/packet/cuts.rb +0 -0
- /data/lib/{deck_of_cards → deck_of_cards_handler}/packet/deals.rb +0 -0
- /data/lib/{deck_of_cards → deck_of_cards_handler}/packet/shuffles.rb +0 -0
- /data/lib/{deck_of_cards → deck_of_cards_handler}/packet.rb +0 -0
@@ -0,0 +1,393 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `tsort` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem tsort`.
|
6
|
+
|
7
|
+
|
8
|
+
# TSort implements topological sorting using Tarjan's algorithm for
|
9
|
+
# strongly connected components.
|
10
|
+
#
|
11
|
+
# TSort is designed to be able to be used with any object which can be
|
12
|
+
# interpreted as a directed graph.
|
13
|
+
#
|
14
|
+
# TSort requires two methods to interpret an object as a graph,
|
15
|
+
# tsort_each_node and tsort_each_child.
|
16
|
+
#
|
17
|
+
# * tsort_each_node is used to iterate for all nodes over a graph.
|
18
|
+
# * tsort_each_child is used to iterate for child nodes of a given node.
|
19
|
+
#
|
20
|
+
# The equality of nodes are defined by eql? and hash since
|
21
|
+
# TSort uses Hash internally.
|
22
|
+
#
|
23
|
+
# == A Simple Example
|
24
|
+
#
|
25
|
+
# The following example demonstrates how to mix the TSort module into an
|
26
|
+
# existing class (in this case, Hash). Here, we're treating each key in
|
27
|
+
# the hash as a node in the graph, and so we simply alias the required
|
28
|
+
# #tsort_each_node method to Hash's #each_key method. For each key in the
|
29
|
+
# hash, the associated value is an array of the node's child nodes. This
|
30
|
+
# choice in turn leads to our implementation of the required #tsort_each_child
|
31
|
+
# method, which fetches the array of child nodes and then iterates over that
|
32
|
+
# array using the user-supplied block.
|
33
|
+
#
|
34
|
+
# require 'tsort'
|
35
|
+
#
|
36
|
+
# class Hash
|
37
|
+
# include TSort
|
38
|
+
# alias tsort_each_node each_key
|
39
|
+
# def tsort_each_child(node, &block)
|
40
|
+
# fetch(node).each(&block)
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# {1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
|
45
|
+
# #=> [3, 2, 1, 4]
|
46
|
+
#
|
47
|
+
# {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_components
|
48
|
+
# #=> [[4], [2, 3], [1]]
|
49
|
+
#
|
50
|
+
# == A More Realistic Example
|
51
|
+
#
|
52
|
+
# A very simple `make' like tool can be implemented as follows:
|
53
|
+
#
|
54
|
+
# require 'tsort'
|
55
|
+
#
|
56
|
+
# class Make
|
57
|
+
# def initialize
|
58
|
+
# @dep = {}
|
59
|
+
# @dep.default = []
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# def rule(outputs, inputs=[], &block)
|
63
|
+
# triple = [outputs, inputs, block]
|
64
|
+
# outputs.each {|f| @dep[f] = [triple]}
|
65
|
+
# @dep[triple] = inputs
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# def build(target)
|
69
|
+
# each_strongly_connected_component_from(target) {|ns|
|
70
|
+
# if ns.length != 1
|
71
|
+
# fs = ns.delete_if {|n| Array === n}
|
72
|
+
# raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
|
73
|
+
# end
|
74
|
+
# n = ns.first
|
75
|
+
# if Array === n
|
76
|
+
# outputs, inputs, block = n
|
77
|
+
# inputs_time = inputs.map {|f| File.mtime f}.max
|
78
|
+
# begin
|
79
|
+
# outputs_time = outputs.map {|f| File.mtime f}.min
|
80
|
+
# rescue Errno::ENOENT
|
81
|
+
# outputs_time = nil
|
82
|
+
# end
|
83
|
+
# if outputs_time == nil ||
|
84
|
+
# inputs_time != nil && outputs_time <= inputs_time
|
85
|
+
# sleep 1 if inputs_time != nil && inputs_time.to_i == Time.now.to_i
|
86
|
+
# block.call
|
87
|
+
# end
|
88
|
+
# end
|
89
|
+
# }
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# def tsort_each_child(node, &block)
|
93
|
+
# @dep[node].each(&block)
|
94
|
+
# end
|
95
|
+
# include TSort
|
96
|
+
# end
|
97
|
+
#
|
98
|
+
# def command(arg)
|
99
|
+
# print arg, "\n"
|
100
|
+
# system arg
|
101
|
+
# end
|
102
|
+
#
|
103
|
+
# m = Make.new
|
104
|
+
# m.rule(%w[t1]) { command 'date > t1' }
|
105
|
+
# m.rule(%w[t2]) { command 'date > t2' }
|
106
|
+
# m.rule(%w[t3]) { command 'date > t3' }
|
107
|
+
# m.rule(%w[t4], %w[t1 t3]) { command 'cat t1 t3 > t4' }
|
108
|
+
# m.rule(%w[t5], %w[t4 t2]) { command 'cat t4 t2 > t5' }
|
109
|
+
# m.build('t5')
|
110
|
+
#
|
111
|
+
# == Bugs
|
112
|
+
#
|
113
|
+
# * 'tsort.rb' is wrong name because this library uses
|
114
|
+
# Tarjan's algorithm for strongly connected components.
|
115
|
+
# Although 'strongly_connected_components.rb' is correct but too long.
|
116
|
+
#
|
117
|
+
# == References
|
118
|
+
#
|
119
|
+
# R. E. Tarjan, "Depth First Search and Linear Graph Algorithms",
|
120
|
+
# <em>SIAM Journal on Computing</em>, Vol. 1, No. 2, pp. 146-160, June 1972.
|
121
|
+
#
|
122
|
+
# source://tsort//lib/tsort.rb#124
|
123
|
+
module TSort
|
124
|
+
# The iterator version of the #strongly_connected_components method.
|
125
|
+
# <tt><em>obj</em>.each_strongly_connected_component</tt> is similar to
|
126
|
+
# <tt><em>obj</em>.strongly_connected_components.each</tt>, but
|
127
|
+
# modification of _obj_ during the iteration may lead to unexpected results.
|
128
|
+
#
|
129
|
+
# #each_strongly_connected_component returns +nil+.
|
130
|
+
#
|
131
|
+
# class G
|
132
|
+
# include TSort
|
133
|
+
# def initialize(g)
|
134
|
+
# @g = g
|
135
|
+
# end
|
136
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
137
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
138
|
+
# end
|
139
|
+
#
|
140
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
141
|
+
# graph.each_strongly_connected_component {|scc| p scc }
|
142
|
+
# #=> [4]
|
143
|
+
# # [2]
|
144
|
+
# # [3]
|
145
|
+
# # [1]
|
146
|
+
#
|
147
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
148
|
+
# graph.each_strongly_connected_component {|scc| p scc }
|
149
|
+
# #=> [4]
|
150
|
+
# # [2, 3]
|
151
|
+
# # [1]
|
152
|
+
#
|
153
|
+
# source://tsort//lib/tsort.rb#316
|
154
|
+
def each_strongly_connected_component(&block); end
|
155
|
+
|
156
|
+
# Iterates over strongly connected component in the subgraph reachable from
|
157
|
+
# _node_.
|
158
|
+
#
|
159
|
+
# Return value is unspecified.
|
160
|
+
#
|
161
|
+
# #each_strongly_connected_component_from doesn't call #tsort_each_node.
|
162
|
+
#
|
163
|
+
# class G
|
164
|
+
# include TSort
|
165
|
+
# def initialize(g)
|
166
|
+
# @g = g
|
167
|
+
# end
|
168
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
169
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
170
|
+
# end
|
171
|
+
#
|
172
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
173
|
+
# graph.each_strongly_connected_component_from(2) {|scc| p scc }
|
174
|
+
# #=> [4]
|
175
|
+
# # [2]
|
176
|
+
#
|
177
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
178
|
+
# graph.each_strongly_connected_component_from(2) {|scc| p scc }
|
179
|
+
# #=> [4]
|
180
|
+
# # [2, 3]
|
181
|
+
#
|
182
|
+
# source://tsort//lib/tsort.rb#386
|
183
|
+
def each_strongly_connected_component_from(node, id_map = T.unsafe(nil), stack = T.unsafe(nil), &block); end
|
184
|
+
|
185
|
+
# Returns strongly connected components as an array of arrays of nodes.
|
186
|
+
# The array is sorted from children to parents.
|
187
|
+
# Each elements of the array represents a strongly connected component.
|
188
|
+
#
|
189
|
+
# class G
|
190
|
+
# include TSort
|
191
|
+
# def initialize(g)
|
192
|
+
# @g = g
|
193
|
+
# end
|
194
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
195
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
196
|
+
# end
|
197
|
+
#
|
198
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
199
|
+
# p graph.strongly_connected_components #=> [[4], [2], [3], [1]]
|
200
|
+
#
|
201
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
202
|
+
# p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
|
203
|
+
#
|
204
|
+
# source://tsort//lib/tsort.rb#257
|
205
|
+
def strongly_connected_components; end
|
206
|
+
|
207
|
+
# Returns a topologically sorted array of nodes.
|
208
|
+
# The array is sorted from children to parents, i.e.
|
209
|
+
# the first element has no child and the last node has no parent.
|
210
|
+
#
|
211
|
+
# If there is a cycle, TSort::Cyclic is raised.
|
212
|
+
#
|
213
|
+
# class G
|
214
|
+
# include TSort
|
215
|
+
# def initialize(g)
|
216
|
+
# @g = g
|
217
|
+
# end
|
218
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
219
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
220
|
+
# end
|
221
|
+
#
|
222
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
223
|
+
# p graph.tsort #=> [4, 2, 3, 1]
|
224
|
+
#
|
225
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
226
|
+
# p graph.tsort # raises TSort::Cyclic
|
227
|
+
#
|
228
|
+
# source://tsort//lib/tsort.rb#152
|
229
|
+
def tsort; end
|
230
|
+
|
231
|
+
# The iterator version of the #tsort method.
|
232
|
+
# <tt><em>obj</em>.tsort_each</tt> is similar to <tt><em>obj</em>.tsort.each</tt>, but
|
233
|
+
# modification of _obj_ during the iteration may lead to unexpected results.
|
234
|
+
#
|
235
|
+
# #tsort_each returns +nil+.
|
236
|
+
# If there is a cycle, TSort::Cyclic is raised.
|
237
|
+
#
|
238
|
+
# class G
|
239
|
+
# include TSort
|
240
|
+
# def initialize(g)
|
241
|
+
# @g = g
|
242
|
+
# end
|
243
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
244
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
245
|
+
# end
|
246
|
+
#
|
247
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
248
|
+
# graph.tsort_each {|n| p n }
|
249
|
+
# #=> 4
|
250
|
+
# # 2
|
251
|
+
# # 3
|
252
|
+
# # 1
|
253
|
+
#
|
254
|
+
# source://tsort//lib/tsort.rb#205
|
255
|
+
def tsort_each(&block); end
|
256
|
+
|
257
|
+
# Should be implemented by a extended class.
|
258
|
+
#
|
259
|
+
# #tsort_each_child is used to iterate for child nodes of _node_.
|
260
|
+
#
|
261
|
+
# @raise [NotImplementedError]
|
262
|
+
#
|
263
|
+
# source://tsort//lib/tsort.rb#452
|
264
|
+
def tsort_each_child(node); end
|
265
|
+
|
266
|
+
# Should be implemented by a extended class.
|
267
|
+
#
|
268
|
+
# #tsort_each_node is used to iterate for all nodes over a graph.
|
269
|
+
#
|
270
|
+
# @raise [NotImplementedError]
|
271
|
+
#
|
272
|
+
# source://tsort//lib/tsort.rb#444
|
273
|
+
def tsort_each_node; end
|
274
|
+
|
275
|
+
class << self
|
276
|
+
# The iterator version of the TSort.strongly_connected_components method.
|
277
|
+
#
|
278
|
+
# The graph is represented by _each_node_ and _each_child_.
|
279
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
280
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
281
|
+
#
|
282
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
283
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
284
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
285
|
+
# TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
|
286
|
+
# #=> [4]
|
287
|
+
# # [2]
|
288
|
+
# # [3]
|
289
|
+
# # [1]
|
290
|
+
#
|
291
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
292
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
293
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
294
|
+
# TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
|
295
|
+
# #=> [4]
|
296
|
+
# # [2, 3]
|
297
|
+
# # [1]
|
298
|
+
#
|
299
|
+
# source://tsort//lib/tsort.rb#345
|
300
|
+
def each_strongly_connected_component(each_node, each_child); end
|
301
|
+
|
302
|
+
# Iterates over strongly connected components in a graph.
|
303
|
+
# The graph is represented by _node_ and _each_child_.
|
304
|
+
#
|
305
|
+
# _node_ is the first node.
|
306
|
+
# _each_child_ should have +call+ method which takes a node argument
|
307
|
+
# and yields for each child node.
|
308
|
+
#
|
309
|
+
# Return value is unspecified.
|
310
|
+
#
|
311
|
+
# #TSort.each_strongly_connected_component_from is a class method and
|
312
|
+
# it doesn't need a class to represent a graph which includes TSort.
|
313
|
+
#
|
314
|
+
# graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
315
|
+
# each_child = lambda {|n, &b| graph[n].each(&b) }
|
316
|
+
# TSort.each_strongly_connected_component_from(1, each_child) {|scc|
|
317
|
+
# p scc
|
318
|
+
# }
|
319
|
+
# #=> [4]
|
320
|
+
# # [2, 3]
|
321
|
+
# # [1]
|
322
|
+
#
|
323
|
+
# source://tsort//lib/tsort.rb#411
|
324
|
+
def each_strongly_connected_component_from(node, each_child, id_map = T.unsafe(nil), stack = T.unsafe(nil)); end
|
325
|
+
|
326
|
+
# Returns strongly connected components as an array of arrays of nodes.
|
327
|
+
# The array is sorted from children to parents.
|
328
|
+
# Each elements of the array represents a strongly connected component.
|
329
|
+
#
|
330
|
+
# The graph is represented by _each_node_ and _each_child_.
|
331
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
332
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
333
|
+
#
|
334
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
335
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
336
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
337
|
+
# p TSort.strongly_connected_components(each_node, each_child)
|
338
|
+
# #=> [[4], [2], [3], [1]]
|
339
|
+
#
|
340
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
341
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
342
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
343
|
+
# p TSort.strongly_connected_components(each_node, each_child)
|
344
|
+
# #=> [[4], [2, 3], [1]]
|
345
|
+
#
|
346
|
+
# source://tsort//lib/tsort.rb#283
|
347
|
+
def strongly_connected_components(each_node, each_child); end
|
348
|
+
|
349
|
+
# Returns a topologically sorted array of nodes.
|
350
|
+
# The array is sorted from children to parents, i.e.
|
351
|
+
# the first element has no child and the last node has no parent.
|
352
|
+
#
|
353
|
+
# The graph is represented by _each_node_ and _each_child_.
|
354
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
355
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
356
|
+
#
|
357
|
+
# If there is a cycle, TSort::Cyclic is raised.
|
358
|
+
#
|
359
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
360
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
361
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
362
|
+
# p TSort.tsort(each_node, each_child) #=> [4, 2, 3, 1]
|
363
|
+
#
|
364
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
365
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
366
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
367
|
+
# p TSort.tsort(each_node, each_child) # raises TSort::Cyclic
|
368
|
+
#
|
369
|
+
# source://tsort//lib/tsort.rb#178
|
370
|
+
def tsort(each_node, each_child); end
|
371
|
+
|
372
|
+
# The iterator version of the TSort.tsort method.
|
373
|
+
#
|
374
|
+
# The graph is represented by _each_node_ and _each_child_.
|
375
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
376
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
377
|
+
#
|
378
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
379
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
380
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
381
|
+
# TSort.tsort_each(each_node, each_child) {|n| p n }
|
382
|
+
# #=> 4
|
383
|
+
# # 2
|
384
|
+
# # 3
|
385
|
+
# # 1
|
386
|
+
#
|
387
|
+
# source://tsort//lib/tsort.rb#226
|
388
|
+
def tsort_each(each_node, each_child); end
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
# source://tsort//lib/tsort.rb#126
|
393
|
+
TSort::VERSION = T.let(T.unsafe(nil), String)
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `unicode-display_width` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem unicode-display_width`.
|
6
|
+
|
7
|
+
|
8
|
+
# source://unicode-display_width//lib/unicode/display_width/constants.rb#3
|
9
|
+
module Unicode; end
|
10
|
+
|
11
|
+
# source://unicode-display_width//lib/unicode/display_width/constants.rb#4
|
12
|
+
class Unicode::DisplayWidth
|
13
|
+
# @return [DisplayWidth] a new instance of DisplayWidth
|
14
|
+
#
|
15
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#229
|
16
|
+
def initialize(ambiguous: T.unsafe(nil), overwrite: T.unsafe(nil), emoji: T.unsafe(nil)); end
|
17
|
+
|
18
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#235
|
19
|
+
def get_config(**kwargs); end
|
20
|
+
|
21
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#243
|
22
|
+
def of(string, **kwargs); end
|
23
|
+
|
24
|
+
class << self
|
25
|
+
# source://unicode-display_width//lib/unicode/display_width/index.rb#14
|
26
|
+
def decompress_index(index, level); end
|
27
|
+
|
28
|
+
# Returns width of all considered Emoji and remaining string
|
29
|
+
#
|
30
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#143
|
31
|
+
def emoji_width(string, mode = T.unsafe(nil), ambiguous = T.unsafe(nil)); end
|
32
|
+
|
33
|
+
# Match possible Emoji first, then refine
|
34
|
+
#
|
35
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#173
|
36
|
+
def emoji_width_via_possible(string, emoji_set_regex, strict_eaw = T.unsafe(nil), ambiguous = T.unsafe(nil)); end
|
37
|
+
|
38
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#201
|
39
|
+
def normalize_options(string, ambiguous = T.unsafe(nil), overwrite = T.unsafe(nil), old_options = T.unsafe(nil), **options); end
|
40
|
+
|
41
|
+
# Returns monospace display width of string
|
42
|
+
#
|
43
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#51
|
44
|
+
def of(string, ambiguous = T.unsafe(nil), overwrite = T.unsafe(nil), old_options = T.unsafe(nil), **options); end
|
45
|
+
|
46
|
+
# Returns width for ASCII-only strings. Will consider zero-width control symbols.
|
47
|
+
#
|
48
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#133
|
49
|
+
def width_ascii(string); end
|
50
|
+
|
51
|
+
# Returns width of custom overwrites and remaining string
|
52
|
+
#
|
53
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#117
|
54
|
+
def width_custom(string, overwrite); end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#16
|
59
|
+
Unicode::DisplayWidth::AMBIGUOUS_MAP = T.let(T.unsafe(nil), Hash)
|
60
|
+
|
61
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#15
|
62
|
+
Unicode::DisplayWidth::ASCII_BACKSPACE = T.let(T.unsafe(nil), String)
|
63
|
+
|
64
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#13
|
65
|
+
Unicode::DisplayWidth::ASCII_NON_ZERO_REGEX = T.let(T.unsafe(nil), Regexp)
|
66
|
+
|
67
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#14
|
68
|
+
Unicode::DisplayWidth::ASCII_NON_ZERO_STRING = T.let(T.unsafe(nil), String)
|
69
|
+
|
70
|
+
# source://unicode-display_width//lib/unicode/display_width/constants.rb#7
|
71
|
+
Unicode::DisplayWidth::DATA_DIRECTORY = T.let(T.unsafe(nil), String)
|
72
|
+
|
73
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#11
|
74
|
+
Unicode::DisplayWidth::DEFAULT_AMBIGUOUS = T.let(T.unsafe(nil), Integer)
|
75
|
+
|
76
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#32
|
77
|
+
Unicode::DisplayWidth::EMOJI_SEQUENCES_REGEX_MAPPING = T.let(T.unsafe(nil), Hash)
|
78
|
+
|
79
|
+
# source://unicode-display_width//lib/unicode/display_width/emoji_support.rb#5
|
80
|
+
module Unicode::DisplayWidth::EmojiSupport
|
81
|
+
class << self
|
82
|
+
# source://unicode-display_width//lib/unicode/display_width/emoji_support.rb#18
|
83
|
+
def _recommended; end
|
84
|
+
|
85
|
+
# Tries to find out which terminal emulator is used to
|
86
|
+
# set emoji: config to best suiting value
|
87
|
+
#
|
88
|
+
# Please also see section in README.md and
|
89
|
+
# misc/terminal-emoji-width.rb
|
90
|
+
#
|
91
|
+
# Please note: Many terminals do not set any ENV vars,
|
92
|
+
# maybe CSI queries can help?
|
93
|
+
#
|
94
|
+
# source://unicode-display_width//lib/unicode/display_width/emoji_support.rb#14
|
95
|
+
def recommended; end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#28
|
100
|
+
Unicode::DisplayWidth::FIRST_4096 = T.let(T.unsafe(nil), Hash)
|
101
|
+
|
102
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#20
|
103
|
+
Unicode::DisplayWidth::FIRST_AMBIGUOUS = T.let(T.unsafe(nil), Hash)
|
104
|
+
|
105
|
+
# source://unicode-display_width//lib/unicode/display_width/index.rb#11
|
106
|
+
Unicode::DisplayWidth::INDEX = T.let(T.unsafe(nil), Hash)
|
107
|
+
|
108
|
+
# source://unicode-display_width//lib/unicode/display_width/constants.rb#8
|
109
|
+
Unicode::DisplayWidth::INDEX_FILENAME = T.let(T.unsafe(nil), String)
|
110
|
+
|
111
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#12
|
112
|
+
Unicode::DisplayWidth::INITIAL_DEPTH = T.let(T.unsafe(nil), Integer)
|
113
|
+
|
114
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#24
|
115
|
+
Unicode::DisplayWidth::NOT_COMMON_NARROW_REGEX = T.let(T.unsafe(nil), Hash)
|
116
|
+
|
117
|
+
# ebase = Unicode::Emoji::REGEX_PROP_MODIFIER_BASE.source
|
118
|
+
#
|
119
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#47
|
120
|
+
Unicode::DisplayWidth::REGEX_EMOJI_ALL_SEQUENCES = T.let(T.unsafe(nil), Regexp)
|
121
|
+
|
122
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#48
|
123
|
+
Unicode::DisplayWidth::REGEX_EMOJI_ALL_SEQUENCES_AND_VS16 = T.let(T.unsafe(nil), Regexp)
|
124
|
+
|
125
|
+
# source://unicode-display_width//lib/unicode/display_width.rb#37
|
126
|
+
Unicode::DisplayWidth::REGEX_EMOJI_VS16 = T.let(T.unsafe(nil), Regexp)
|
127
|
+
|
128
|
+
# source://unicode-display_width//lib/unicode/display_width/constants.rb#6
|
129
|
+
Unicode::DisplayWidth::UNICODE_VERSION = T.let(T.unsafe(nil), String)
|
130
|
+
|
131
|
+
# source://unicode-display_width//lib/unicode/display_width/constants.rb#5
|
132
|
+
Unicode::DisplayWidth::VERSION = T.let(T.unsafe(nil), String)
|