deck_of_cards_handler 0.1.0 → 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,846 @@
|
|
1
|
+
# typed: false
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `erb` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem erb`.
|
6
|
+
|
7
|
+
|
8
|
+
# source://erb//lib/erb/version.rb#2
|
9
|
+
class ERB
|
10
|
+
# :markup: markdown
|
11
|
+
#
|
12
|
+
# :call-seq:
|
13
|
+
# ERB.new(template, trim_mode: nil, eoutvar: '_erbout')
|
14
|
+
#
|
15
|
+
# Returns a new \ERB object containing the given string +template+.
|
16
|
+
#
|
17
|
+
# For details about `template`, its embedded tags, and generated results, see ERB.
|
18
|
+
#
|
19
|
+
# **Keyword Argument `trim_mode`**
|
20
|
+
#
|
21
|
+
# You can use keyword argument `trim_mode: '%'`
|
22
|
+
# to enable the [shorthand format][shorthand format] for execution tags.
|
23
|
+
#
|
24
|
+
# This value allows [blank line control][blank line control]:
|
25
|
+
#
|
26
|
+
# - `'-'`: Omit each blank line ending with `'%>'`.
|
27
|
+
#
|
28
|
+
# Other values allow [newline control][newline control]:
|
29
|
+
#
|
30
|
+
# - `'>'`: Omit newline for each line ending with `'%>'`.
|
31
|
+
# - `'<>'`: Omit newline for each line starting with `'<%'` and ending with `'%>'`.
|
32
|
+
#
|
33
|
+
# You can also [combine trim modes][combine trim modes].
|
34
|
+
#
|
35
|
+
# **Keyword Argument `eoutvar`**
|
36
|
+
#
|
37
|
+
# The string value of keyword argument `eoutvar` specifies the name of the variable
|
38
|
+
# that method #result uses to construct its result string;
|
39
|
+
# see #src.
|
40
|
+
#
|
41
|
+
# This is useful when you need to run multiple \ERB templates through the same binding
|
42
|
+
# and/or when you want to control where output ends up.
|
43
|
+
#
|
44
|
+
# It's good practice to choose a variable name that begins with an underscore: `'_'`.
|
45
|
+
#
|
46
|
+
# <b>Backward Compatibility</b>
|
47
|
+
#
|
48
|
+
# The calling sequence given above -- which is the one you should use --
|
49
|
+
# is a simplified version of the complete formal calling sequence,
|
50
|
+
# which is:
|
51
|
+
#
|
52
|
+
# ```
|
53
|
+
# ERB.new(template,
|
54
|
+
# safe_level=NOT_GIVEN, legacy_trim_mode=NOT_GIVEN, legacy_eoutvar=NOT_GIVEN,
|
55
|
+
# trim_mode: nil, eoutvar: '_erbout')
|
56
|
+
# ```
|
57
|
+
#
|
58
|
+
# The second, third, and fourth positional arguments (those in the second line above) are deprecated;
|
59
|
+
# this method issues warnings if they are given.
|
60
|
+
#
|
61
|
+
# However, their values, if given, are handled thus:
|
62
|
+
#
|
63
|
+
# - `safe_level`: ignored.
|
64
|
+
# - `legacy_trim_mode`: overrides keyword argument `trim_mode`.
|
65
|
+
# - `legacy_eoutvar`: overrides keyword argument `eoutvar`.
|
66
|
+
#
|
67
|
+
# [blank line control]: rdoc-ref:ERB@Suppressing+Unwanted+Blank+Lines
|
68
|
+
# [combine trim modes]: rdoc-ref:ERB@Combining+Trim+Modes
|
69
|
+
# [newline control]: rdoc-ref:ERB@Suppressing+Unwanted+Newlines
|
70
|
+
# [shorthand format]: rdoc-ref:ERB@Shorthand+Format+for+Execution+Tags
|
71
|
+
#
|
72
|
+
# @return [ERB] a new instance of ERB
|
73
|
+
#
|
74
|
+
# source://erb//lib/erb.rb#856
|
75
|
+
def initialize(str, safe_level = T.unsafe(nil), legacy_trim_mode = T.unsafe(nil), legacy_eoutvar = T.unsafe(nil), trim_mode: T.unsafe(nil), eoutvar: T.unsafe(nil)); end
|
76
|
+
|
77
|
+
# :markup: markdown
|
78
|
+
#
|
79
|
+
# :call-seq:
|
80
|
+
# def_class(super_class = Object, method_name = 'result') -> new_class
|
81
|
+
#
|
82
|
+
# Returns a new nameless class whose superclass is `super_class`,
|
83
|
+
# and which has instance method `method_name`.
|
84
|
+
#
|
85
|
+
# Create a template from HTML that has embedded expression tags that use `@arg1` and `@arg2`:
|
86
|
+
#
|
87
|
+
# ```
|
88
|
+
# html = <<TEMPLATE
|
89
|
+
# <html>
|
90
|
+
# <body>
|
91
|
+
# <p><%= @arg1 %></p>
|
92
|
+
# <p><%= @arg2 %></p>
|
93
|
+
# </body>
|
94
|
+
# </html>
|
95
|
+
# TEMPLATE
|
96
|
+
# template = ERB.new(html)
|
97
|
+
# ```
|
98
|
+
#
|
99
|
+
# Create a base class that has `@arg1` and `@arg2`:
|
100
|
+
#
|
101
|
+
# ```
|
102
|
+
# class MyBaseClass
|
103
|
+
# def initialize(arg1, arg2)
|
104
|
+
# @arg1 = arg1
|
105
|
+
# @arg2 = arg2
|
106
|
+
# end
|
107
|
+
# end
|
108
|
+
# ```
|
109
|
+
#
|
110
|
+
# Use method #def_class to create a subclass that has method `:render`:
|
111
|
+
#
|
112
|
+
# ```
|
113
|
+
# MySubClass = template.def_class(MyBaseClass, :render)
|
114
|
+
# ```
|
115
|
+
#
|
116
|
+
# Generate the result:
|
117
|
+
#
|
118
|
+
# ```
|
119
|
+
# puts MySubClass.new('foo', 123).render
|
120
|
+
# <html>
|
121
|
+
# <body>
|
122
|
+
# <p>foo</p>
|
123
|
+
# <p>123</p>
|
124
|
+
# </body>
|
125
|
+
# </html>
|
126
|
+
# ```
|
127
|
+
#
|
128
|
+
# source://erb//lib/erb.rb#1215
|
129
|
+
def def_class(superklass = T.unsafe(nil), methodname = T.unsafe(nil)); end
|
130
|
+
|
131
|
+
# :markup: markdown
|
132
|
+
#
|
133
|
+
# :call-seq:
|
134
|
+
# def_method(module, method_signature, filename = '(ERB)') -> method_name
|
135
|
+
#
|
136
|
+
# Creates and returns a new instance method in the given module `module`;
|
137
|
+
# returns the method name as a symbol.
|
138
|
+
#
|
139
|
+
# The method is created from the given `method_signature`,
|
140
|
+
# which consists of the method name and its argument names (if any).
|
141
|
+
#
|
142
|
+
# The `filename` sets the value of #filename;
|
143
|
+
# see [Error Reporting][error reporting].
|
144
|
+
#
|
145
|
+
# [error reporting]: rdoc-ref:ERB@Error+Reporting
|
146
|
+
#
|
147
|
+
# ```
|
148
|
+
# template = '<%= arg1 %> <%= arg2 %>'
|
149
|
+
# erb = ERB.new(template)
|
150
|
+
# MyModule = Module.new
|
151
|
+
# erb.def_method(MyModule, 'render(arg1, arg2)') # => :render
|
152
|
+
# class MyClass; include MyModule; end
|
153
|
+
# MyClass.new.render('foo', 123) # => "foo 123"
|
154
|
+
# ```
|
155
|
+
#
|
156
|
+
# source://erb//lib/erb.rb#1132
|
157
|
+
def def_method(mod, methodname, fname = T.unsafe(nil)); end
|
158
|
+
|
159
|
+
# :markup: markdown
|
160
|
+
#
|
161
|
+
# :call-seq:
|
162
|
+
# def_module(method_name = 'erb') -> new_module
|
163
|
+
#
|
164
|
+
# Returns a new nameless module that has instance method `method_name`.
|
165
|
+
#
|
166
|
+
# ```
|
167
|
+
# template = '<%= arg1 %> <%= arg2 %>'
|
168
|
+
# erb = ERB.new(template)
|
169
|
+
# MyModule = template.def_module('render(arg1, arg2)')
|
170
|
+
# class MyClass
|
171
|
+
# include MyModule
|
172
|
+
# end
|
173
|
+
# MyClass.new.render('foo', 123)
|
174
|
+
# # => "foo 123"
|
175
|
+
# ```
|
176
|
+
#
|
177
|
+
# source://erb//lib/erb.rb#1157
|
178
|
+
def def_module(methodname = T.unsafe(nil)); end
|
179
|
+
|
180
|
+
# :markup: markdown
|
181
|
+
#
|
182
|
+
# Returns the encoding of `self`;
|
183
|
+
# see [Encodings][encodings]:
|
184
|
+
#
|
185
|
+
# [encodings]: rdoc-ref:ERB@Encodings
|
186
|
+
#
|
187
|
+
# source://erb//lib/erb.rb#953
|
188
|
+
def encoding; end
|
189
|
+
|
190
|
+
# :markup: markdown
|
191
|
+
#
|
192
|
+
# Sets or returns the file name to be used in reporting errors;
|
193
|
+
# see [Error Reporting][error reporting].
|
194
|
+
#
|
195
|
+
# [error reporting]: rdoc-ref:ERB@Error+Reporting
|
196
|
+
#
|
197
|
+
# source://erb//lib/erb.rb#961
|
198
|
+
def filename; end
|
199
|
+
|
200
|
+
# :markup: markdown
|
201
|
+
#
|
202
|
+
# Sets or returns the file name to be used in reporting errors;
|
203
|
+
# see [Error Reporting][error reporting].
|
204
|
+
#
|
205
|
+
# [error reporting]: rdoc-ref:ERB@Error+Reporting
|
206
|
+
#
|
207
|
+
# source://erb//lib/erb.rb#961
|
208
|
+
def filename=(_arg0); end
|
209
|
+
|
210
|
+
# :markup: markdown
|
211
|
+
#
|
212
|
+
# Sets or returns the line number to be used in reporting errors;
|
213
|
+
# see [Error Reporting][error reporting].
|
214
|
+
#
|
215
|
+
# [error reporting]: rdoc-ref:ERB@Error+Reporting
|
216
|
+
#
|
217
|
+
# source://erb//lib/erb.rb#969
|
218
|
+
def lineno; end
|
219
|
+
|
220
|
+
# :markup: markdown
|
221
|
+
#
|
222
|
+
# Sets or returns the line number to be used in reporting errors;
|
223
|
+
# see [Error Reporting][error reporting].
|
224
|
+
#
|
225
|
+
# [error reporting]: rdoc-ref:ERB@Error+Reporting
|
226
|
+
#
|
227
|
+
# source://erb//lib/erb.rb#969
|
228
|
+
def lineno=(_arg0); end
|
229
|
+
|
230
|
+
# :markup: markdown
|
231
|
+
#
|
232
|
+
# :call-seq:
|
233
|
+
# location = [filename, lineno] => [filename, lineno]
|
234
|
+
# location = filename -> filename
|
235
|
+
#
|
236
|
+
# Sets the values of #filename and, if given, #lineno;
|
237
|
+
# see [Error Reporting][error reporting].
|
238
|
+
#
|
239
|
+
# [error reporting]: rdoc-ref:ERB@Error+Reporting
|
240
|
+
#
|
241
|
+
# source://erb//lib/erb.rb#981
|
242
|
+
def location=(_arg0); end
|
243
|
+
|
244
|
+
# :markup: markdown
|
245
|
+
#
|
246
|
+
# :call-seq:
|
247
|
+
# make_compiler -> erb_compiler
|
248
|
+
#
|
249
|
+
# Returns a new ERB::Compiler with the given `trim_mode`;
|
250
|
+
# for `trim_mode` values, see ERB.new:
|
251
|
+
#
|
252
|
+
# ```
|
253
|
+
# ERB.new('').make_compiler(nil)
|
254
|
+
# # => #<ERB::Compiler:0x000001cff9467678 @insert_cmd="print", @percent=false, @post_cmd=[], @pre_cmd=[], @put_cmd="print", @trim_mode=nil>
|
255
|
+
# ```
|
256
|
+
#
|
257
|
+
# source://erb//lib/erb.rb#898
|
258
|
+
def make_compiler(trim_mode); end
|
259
|
+
|
260
|
+
# :markup: markdown
|
261
|
+
#
|
262
|
+
# :call-seq:
|
263
|
+
# result(binding = new_toplevel) -> new_string
|
264
|
+
#
|
265
|
+
# Returns the string result formed by processing \ERB tags found in the stored template in `self`.
|
266
|
+
#
|
267
|
+
# With no argument given, uses the default binding;
|
268
|
+
# see [Default Binding][default binding].
|
269
|
+
#
|
270
|
+
# With argument `binding` given, uses the local binding;
|
271
|
+
# see [Local Binding][local binding].
|
272
|
+
#
|
273
|
+
# See also #result_with_hash.
|
274
|
+
#
|
275
|
+
# [default binding]: rdoc-ref:ERB@Default+Binding
|
276
|
+
# [local binding]: rdoc-ref:ERB@Local+Binding
|
277
|
+
#
|
278
|
+
# source://erb//lib/erb.rb#1052
|
279
|
+
def result(b = T.unsafe(nil)); end
|
280
|
+
|
281
|
+
# :markup: markdown
|
282
|
+
#
|
283
|
+
# :call-seq:
|
284
|
+
# result_with_hash(hash) -> new_string
|
285
|
+
#
|
286
|
+
# Returns the string result formed by processing \ERB tags found in the stored string in `self`;
|
287
|
+
# see [Augmented Binding][augmented binding].
|
288
|
+
#
|
289
|
+
# See also #result.
|
290
|
+
#
|
291
|
+
# [augmented binding]: rdoc-ref:ERB@Augmented+Binding
|
292
|
+
#
|
293
|
+
# source://erb//lib/erb.rb#1071
|
294
|
+
def result_with_hash(hash); end
|
295
|
+
|
296
|
+
# :markup: markdown
|
297
|
+
#
|
298
|
+
# :call-seq:
|
299
|
+
# run(binding = new_toplevel) -> nil
|
300
|
+
#
|
301
|
+
# Like #result, but prints the result string (instead of returning it);
|
302
|
+
# returns `nil`.
|
303
|
+
#
|
304
|
+
# source://erb//lib/erb.rb#1030
|
305
|
+
def run(b = T.unsafe(nil)); end
|
306
|
+
|
307
|
+
# :markup: markdown
|
308
|
+
#
|
309
|
+
# :call-seq:
|
310
|
+
# set_eoutvar(compiler, eoutvar = '_erbout') -> [eoutvar]
|
311
|
+
#
|
312
|
+
# Sets the `eoutvar` value in the ERB::Compiler object `compiler`;
|
313
|
+
# returns a 1-element array containing the value of `eoutvar`:
|
314
|
+
#
|
315
|
+
# ```
|
316
|
+
# template = ERB.new('')
|
317
|
+
# compiler = template.make_compiler(nil)
|
318
|
+
# pp compiler
|
319
|
+
# #<ERB::Compiler:0x000001cff8a9aa00
|
320
|
+
# @insert_cmd="print",
|
321
|
+
# @percent=false,
|
322
|
+
# @post_cmd=[],
|
323
|
+
# @pre_cmd=[],
|
324
|
+
# @put_cmd="print",
|
325
|
+
# @trim_mode=nil>
|
326
|
+
# template.set_eoutvar(compiler, '_foo') # => ["_foo"]
|
327
|
+
# pp compiler
|
328
|
+
# #<ERB::Compiler:0x000001cff8a9aa00
|
329
|
+
# @insert_cmd="_foo.<<",
|
330
|
+
# @percent=false,
|
331
|
+
# @post_cmd=["_foo"],
|
332
|
+
# @pre_cmd=["_foo = +''"],
|
333
|
+
# @put_cmd="_foo.<<",
|
334
|
+
# @trim_mode=nil>
|
335
|
+
# ```
|
336
|
+
#
|
337
|
+
# source://erb//lib/erb.rb#1016
|
338
|
+
def set_eoutvar(compiler, eoutvar = T.unsafe(nil)); end
|
339
|
+
|
340
|
+
# :markup: markdown
|
341
|
+
#
|
342
|
+
# Returns the Ruby code that, when executed, generates the result;
|
343
|
+
# the code is executed by method #result,
|
344
|
+
# and by its wrapper methods #result_with_hash and #run:
|
345
|
+
#
|
346
|
+
# ```
|
347
|
+
# template = 'The time is <%= Time.now %>.'
|
348
|
+
# erb = ERB.new(template)
|
349
|
+
# erb.src
|
350
|
+
# # => "#coding:UTF-8\n_erbout = +''; _erbout.<< \"The time is \".freeze; _erbout.<<(( Time.now ).to_s); _erbout.<< \".\".freeze; _erbout"
|
351
|
+
# erb.result
|
352
|
+
# # => "The time is 2025-09-18 15:58:08 -0500."
|
353
|
+
# ```
|
354
|
+
#
|
355
|
+
# In a more readable format:
|
356
|
+
#
|
357
|
+
# ```
|
358
|
+
# # puts erb.src.split('; ')
|
359
|
+
# # #coding:UTF-8
|
360
|
+
# # _erbout = +''
|
361
|
+
# # _erbout.<< "The time is ".freeze
|
362
|
+
# # _erbout.<<(( Time.now ).to_s)
|
363
|
+
# # _erbout.<< ".".freeze
|
364
|
+
# # _erbout
|
365
|
+
# ```
|
366
|
+
#
|
367
|
+
# Variable `_erbout` is used to store the intermediate results in the code;
|
368
|
+
# the name `_erbout` is the default in ERB.new,
|
369
|
+
# and can be changed via keyword argument `eoutvar`:
|
370
|
+
#
|
371
|
+
# ```
|
372
|
+
# erb = ERB.new(template, eoutvar: '_foo')
|
373
|
+
# puts template.src.split('; ')
|
374
|
+
# #coding:UTF-8
|
375
|
+
# _foo = +''
|
376
|
+
# _foo.<< "The time is ".freeze
|
377
|
+
# _foo.<<(( Time.now ).to_s)
|
378
|
+
# _foo.<< ".".freeze
|
379
|
+
# _foo
|
380
|
+
# ```
|
381
|
+
#
|
382
|
+
# source://erb//lib/erb.rb#944
|
383
|
+
def src; end
|
384
|
+
|
385
|
+
private
|
386
|
+
|
387
|
+
# :markup: markdown
|
388
|
+
#
|
389
|
+
# :call-seq:
|
390
|
+
# new_toplevel(symbols) -> new_binding
|
391
|
+
#
|
392
|
+
# Returns a new binding based on `TOPLEVEL_BINDING`;
|
393
|
+
# used to create a default binding for a call to #result.
|
394
|
+
#
|
395
|
+
# See [Default Binding][default binding].
|
396
|
+
#
|
397
|
+
# Argument `symbols` is an array of symbols;
|
398
|
+
# each symbol `symbol` is defined as a new variable to hide and
|
399
|
+
# prevent it from overwriting a variable of the same name already
|
400
|
+
# defined within the binding.
|
401
|
+
#
|
402
|
+
# [default binding]: rdoc-ref:ERB@Default+Binding
|
403
|
+
#
|
404
|
+
# source://erb//lib/erb.rb#1095
|
405
|
+
def new_toplevel(vars = T.unsafe(nil)); end
|
406
|
+
|
407
|
+
class << self
|
408
|
+
# :markup: markdown
|
409
|
+
#
|
410
|
+
# :call-seq:
|
411
|
+
# self.version -> string
|
412
|
+
#
|
413
|
+
# Returns the string \ERB version.
|
414
|
+
#
|
415
|
+
# source://erb//lib/erb.rb#790
|
416
|
+
def version; end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
# --
|
421
|
+
# ERB::Compiler
|
422
|
+
#
|
423
|
+
# Compiles ERB templates into Ruby code; the compiled code produces the
|
424
|
+
# template result when evaluated. ERB::Compiler provides hooks to define how
|
425
|
+
# generated output is handled.
|
426
|
+
#
|
427
|
+
# Internally ERB does something like this to generate the code returned by
|
428
|
+
# ERB#src:
|
429
|
+
#
|
430
|
+
# compiler = ERB::Compiler.new('<>')
|
431
|
+
# compiler.pre_cmd = ["_erbout=+''"]
|
432
|
+
# compiler.put_cmd = "_erbout.<<"
|
433
|
+
# compiler.insert_cmd = "_erbout.<<"
|
434
|
+
# compiler.post_cmd = ["_erbout"]
|
435
|
+
#
|
436
|
+
# code, enc = compiler.compile("Got <%= obj %>!\n")
|
437
|
+
# puts code
|
438
|
+
#
|
439
|
+
# <i>Generates</i>:
|
440
|
+
#
|
441
|
+
# #coding:UTF-8
|
442
|
+
# _erbout=+''; _erbout.<< "Got ".freeze; _erbout.<<(( obj ).to_s); _erbout.<< "!\n".freeze; _erbout
|
443
|
+
#
|
444
|
+
# By default the output is sent to the print method. For example:
|
445
|
+
#
|
446
|
+
# compiler = ERB::Compiler.new('<>')
|
447
|
+
# code, enc = compiler.compile("Got <%= obj %>!\n")
|
448
|
+
# puts code
|
449
|
+
#
|
450
|
+
# <i>Generates</i>:
|
451
|
+
#
|
452
|
+
# #coding:UTF-8
|
453
|
+
# print "Got ".freeze; print(( obj ).to_s); print "!\n".freeze
|
454
|
+
#
|
455
|
+
# == Evaluation
|
456
|
+
#
|
457
|
+
# The compiled code can be used in any context where the names in the code
|
458
|
+
# correctly resolve. Using the last example, each of these print 'Got It!'
|
459
|
+
#
|
460
|
+
# Evaluate using a variable:
|
461
|
+
#
|
462
|
+
# obj = 'It'
|
463
|
+
# eval code
|
464
|
+
#
|
465
|
+
# Evaluate using an input:
|
466
|
+
#
|
467
|
+
# mod = Module.new
|
468
|
+
# mod.module_eval %{
|
469
|
+
# def get(obj)
|
470
|
+
# #{code}
|
471
|
+
# end
|
472
|
+
# }
|
473
|
+
# extend mod
|
474
|
+
# get('It')
|
475
|
+
#
|
476
|
+
# Evaluate using an accessor:
|
477
|
+
#
|
478
|
+
# klass = Class.new Object
|
479
|
+
# klass.class_eval %{
|
480
|
+
# attr_accessor :obj
|
481
|
+
# def initialize(obj)
|
482
|
+
# @obj = obj
|
483
|
+
# end
|
484
|
+
# def get_it
|
485
|
+
# #{code}
|
486
|
+
# end
|
487
|
+
# }
|
488
|
+
# klass.new('It').get_it
|
489
|
+
#
|
490
|
+
# Good! See also ERB#def_method, ERB#def_module, and ERB#def_class.
|
491
|
+
#
|
492
|
+
# source://erb//lib/erb/compiler.rb#73
|
493
|
+
class ERB::Compiler
|
494
|
+
# Construct a new compiler using the trim_mode. See ERB::new for available
|
495
|
+
# trim modes.
|
496
|
+
#
|
497
|
+
# @return [Compiler] a new instance of Compiler
|
498
|
+
#
|
499
|
+
# source://erb//lib/erb/compiler.rb#433
|
500
|
+
def initialize(trim_mode); end
|
501
|
+
|
502
|
+
# source://erb//lib/erb/compiler.rb#315
|
503
|
+
def add_insert_cmd(out, content); end
|
504
|
+
|
505
|
+
# source://erb//lib/erb/compiler.rb#311
|
506
|
+
def add_put_cmd(out, content); end
|
507
|
+
|
508
|
+
# Compiles an ERB template into Ruby code. Returns an array of the code
|
509
|
+
# and encoding like ["code", Encoding].
|
510
|
+
#
|
511
|
+
# @raise [ArgumentError]
|
512
|
+
#
|
513
|
+
# source://erb//lib/erb/compiler.rb#321
|
514
|
+
def compile(s); end
|
515
|
+
|
516
|
+
# source://erb//lib/erb/compiler.rb#381
|
517
|
+
def compile_content(stag, out); end
|
518
|
+
|
519
|
+
# source://erb//lib/erb/compiler.rb#368
|
520
|
+
def compile_etag(etag, out, scanner); end
|
521
|
+
|
522
|
+
# source://erb//lib/erb/compiler.rb#344
|
523
|
+
def compile_stag(stag, out, scanner); end
|
524
|
+
|
525
|
+
# The command to handle text that is inserted prior to a newline
|
526
|
+
#
|
527
|
+
# source://erb//lib/erb/compiler.rb#446
|
528
|
+
def insert_cmd; end
|
529
|
+
|
530
|
+
# The command to handle text that is inserted prior to a newline
|
531
|
+
#
|
532
|
+
# source://erb//lib/erb/compiler.rb#446
|
533
|
+
def insert_cmd=(_arg0); end
|
534
|
+
|
535
|
+
# source://erb//lib/erb/compiler.rb#427
|
536
|
+
def make_scanner(src); end
|
537
|
+
|
538
|
+
# Returns the value of attribute percent.
|
539
|
+
#
|
540
|
+
# source://erb//lib/erb/compiler.rb#440
|
541
|
+
def percent; end
|
542
|
+
|
543
|
+
# An array of commands appended to compiled code
|
544
|
+
#
|
545
|
+
# source://erb//lib/erb/compiler.rb#452
|
546
|
+
def post_cmd; end
|
547
|
+
|
548
|
+
# An array of commands appended to compiled code
|
549
|
+
#
|
550
|
+
# source://erb//lib/erb/compiler.rb#452
|
551
|
+
def post_cmd=(_arg0); end
|
552
|
+
|
553
|
+
# An array of commands prepended to compiled code
|
554
|
+
#
|
555
|
+
# source://erb//lib/erb/compiler.rb#449
|
556
|
+
def pre_cmd; end
|
557
|
+
|
558
|
+
# An array of commands prepended to compiled code
|
559
|
+
#
|
560
|
+
# source://erb//lib/erb/compiler.rb#449
|
561
|
+
def pre_cmd=(_arg0); end
|
562
|
+
|
563
|
+
# source://erb//lib/erb/compiler.rb#398
|
564
|
+
def prepare_trim_mode(mode); end
|
565
|
+
|
566
|
+
# The command to handle text that ends with a newline
|
567
|
+
#
|
568
|
+
# source://erb//lib/erb/compiler.rb#443
|
569
|
+
def put_cmd; end
|
570
|
+
|
571
|
+
# The command to handle text that ends with a newline
|
572
|
+
#
|
573
|
+
# source://erb//lib/erb/compiler.rb#443
|
574
|
+
def put_cmd=(_arg0); end
|
575
|
+
|
576
|
+
# Returns the value of attribute trim_mode.
|
577
|
+
#
|
578
|
+
# source://erb//lib/erb/compiler.rb#440
|
579
|
+
def trim_mode; end
|
580
|
+
|
581
|
+
private
|
582
|
+
|
583
|
+
# A buffered text in #compile
|
584
|
+
#
|
585
|
+
# source://erb//lib/erb/compiler.rb#457
|
586
|
+
def content; end
|
587
|
+
|
588
|
+
# A buffered text in #compile
|
589
|
+
#
|
590
|
+
# source://erb//lib/erb/compiler.rb#457
|
591
|
+
def content=(_arg0); end
|
592
|
+
|
593
|
+
# source://erb//lib/erb/compiler.rb#459
|
594
|
+
def detect_magic_comment(s, enc = T.unsafe(nil)); end
|
595
|
+
|
596
|
+
# :startdoc:
|
597
|
+
#
|
598
|
+
# source://erb//lib/erb/compiler.rb#485
|
599
|
+
def warn_invalid_trim_mode(mode, uplevel:); end
|
600
|
+
end
|
601
|
+
|
602
|
+
# source://erb//lib/erb/compiler.rb#278
|
603
|
+
class ERB::Compiler::Buffer
|
604
|
+
# @return [Buffer] a new instance of Buffer
|
605
|
+
#
|
606
|
+
# source://erb//lib/erb/compiler.rb#279
|
607
|
+
def initialize(compiler, enc = T.unsafe(nil), frozen = T.unsafe(nil)); end
|
608
|
+
|
609
|
+
# source://erb//lib/erb/compiler.rb#301
|
610
|
+
def close; end
|
611
|
+
|
612
|
+
# source://erb//lib/erb/compiler.rb#295
|
613
|
+
def cr; end
|
614
|
+
|
615
|
+
# source://erb//lib/erb/compiler.rb#291
|
616
|
+
def push(cmd); end
|
617
|
+
|
618
|
+
# Returns the value of attribute script.
|
619
|
+
#
|
620
|
+
# source://erb//lib/erb/compiler.rb#289
|
621
|
+
def script; end
|
622
|
+
end
|
623
|
+
|
624
|
+
# source://erb//lib/erb/compiler.rb#254
|
625
|
+
class ERB::Compiler::ExplicitScanner < ::ERB::Compiler::Scanner
|
626
|
+
# source://erb//lib/erb/compiler.rb#255
|
627
|
+
def scan; end
|
628
|
+
end
|
629
|
+
|
630
|
+
# source://erb//lib/erb/compiler.rb#74
|
631
|
+
class ERB::Compiler::PercentLine
|
632
|
+
# @return [PercentLine] a new instance of PercentLine
|
633
|
+
#
|
634
|
+
# source://erb//lib/erb/compiler.rb#75
|
635
|
+
def initialize(str); end
|
636
|
+
|
637
|
+
# Returns the value of attribute value.
|
638
|
+
#
|
639
|
+
# source://erb//lib/erb/compiler.rb#79
|
640
|
+
def to_s; end
|
641
|
+
|
642
|
+
# Returns the value of attribute value.
|
643
|
+
#
|
644
|
+
# source://erb//lib/erb/compiler.rb#78
|
645
|
+
def value; end
|
646
|
+
end
|
647
|
+
|
648
|
+
# source://erb//lib/erb/compiler.rb#82
|
649
|
+
class ERB::Compiler::Scanner
|
650
|
+
# @return [Scanner] a new instance of Scanner
|
651
|
+
#
|
652
|
+
# source://erb//lib/erb/compiler.rb#108
|
653
|
+
def initialize(src, trim_mode, percent); end
|
654
|
+
|
655
|
+
# Returns the value of attribute etags.
|
656
|
+
#
|
657
|
+
# source://erb//lib/erb/compiler.rb#115
|
658
|
+
def etags; end
|
659
|
+
|
660
|
+
# source://erb//lib/erb/compiler.rb#117
|
661
|
+
def scan; end
|
662
|
+
|
663
|
+
# Returns the value of attribute stag.
|
664
|
+
#
|
665
|
+
# source://erb//lib/erb/compiler.rb#114
|
666
|
+
def stag; end
|
667
|
+
|
668
|
+
# Sets the attribute stag
|
669
|
+
#
|
670
|
+
# @param value the value to set the attribute stag to.
|
671
|
+
#
|
672
|
+
# source://erb//lib/erb/compiler.rb#114
|
673
|
+
def stag=(_arg0); end
|
674
|
+
|
675
|
+
# Returns the value of attribute stags.
|
676
|
+
#
|
677
|
+
# source://erb//lib/erb/compiler.rb#115
|
678
|
+
def stags; end
|
679
|
+
|
680
|
+
class << self
|
681
|
+
# source://erb//lib/erb/compiler.rb#97
|
682
|
+
def default_scanner=(klass); end
|
683
|
+
|
684
|
+
# source://erb//lib/erb/compiler.rb#101
|
685
|
+
def make_scanner(src, trim_mode, percent); end
|
686
|
+
|
687
|
+
# source://erb//lib/erb/compiler.rb#94
|
688
|
+
def regist_scanner(klass, trim_mode, percent); end
|
689
|
+
|
690
|
+
# source://erb//lib/erb/compiler.rb#86
|
691
|
+
def register_scanner(klass, trim_mode, percent); end
|
692
|
+
end
|
693
|
+
end
|
694
|
+
|
695
|
+
# source://erb//lib/erb/compiler.rb#107
|
696
|
+
ERB::Compiler::Scanner::DEFAULT_ETAGS = T.let(T.unsafe(nil), Array)
|
697
|
+
|
698
|
+
# source://erb//lib/erb/compiler.rb#106
|
699
|
+
ERB::Compiler::Scanner::DEFAULT_STAGS = T.let(T.unsafe(nil), Array)
|
700
|
+
|
701
|
+
# source://erb//lib/erb/compiler.rb#240
|
702
|
+
class ERB::Compiler::SimpleScanner < ::ERB::Compiler::Scanner
|
703
|
+
# source://erb//lib/erb/compiler.rb#241
|
704
|
+
def scan; end
|
705
|
+
end
|
706
|
+
|
707
|
+
# source://erb//lib/erb/compiler.rb#120
|
708
|
+
class ERB::Compiler::TrimScanner < ::ERB::Compiler::Scanner
|
709
|
+
# @return [TrimScanner] a new instance of TrimScanner
|
710
|
+
#
|
711
|
+
# source://erb//lib/erb/compiler.rb#121
|
712
|
+
def initialize(src, trim_mode, percent); end
|
713
|
+
|
714
|
+
# source://erb//lib/erb/compiler.rb#210
|
715
|
+
def explicit_trim_line(line); end
|
716
|
+
|
717
|
+
# @return [Boolean]
|
718
|
+
#
|
719
|
+
# source://erb//lib/erb/compiler.rb#229
|
720
|
+
def is_erb_stag?(s); end
|
721
|
+
|
722
|
+
# source://erb//lib/erb/compiler.rb#152
|
723
|
+
def percent_line(line, &block); end
|
724
|
+
|
725
|
+
# source://erb//lib/erb/compiler.rb#140
|
726
|
+
def scan(&block); end
|
727
|
+
|
728
|
+
# source://erb//lib/erb/compiler.rb#165
|
729
|
+
def scan_line(line); end
|
730
|
+
|
731
|
+
# source://erb//lib/erb/compiler.rb#174
|
732
|
+
def trim_line1(line); end
|
733
|
+
|
734
|
+
# source://erb//lib/erb/compiler.rb#188
|
735
|
+
def trim_line2(line); end
|
736
|
+
end
|
737
|
+
|
738
|
+
# :stopdoc:
|
739
|
+
#
|
740
|
+
# source://erb//lib/erb/compiler.rb#476
|
741
|
+
ERB::Compiler::WARNING_UPLEVEL = T.let(T.unsafe(nil), Integer)
|
742
|
+
|
743
|
+
# ERB::DefMethod
|
744
|
+
#
|
745
|
+
# Utility module to define eRuby script as instance method.
|
746
|
+
#
|
747
|
+
# === Example
|
748
|
+
#
|
749
|
+
# example.rhtml:
|
750
|
+
# <% for item in @items %>
|
751
|
+
# <b><%= item %></b>
|
752
|
+
# <% end %>
|
753
|
+
#
|
754
|
+
# example.rb:
|
755
|
+
# require 'erb'
|
756
|
+
# class MyClass
|
757
|
+
# extend ERB::DefMethod
|
758
|
+
# def_erb_method('render()', 'example.rhtml')
|
759
|
+
# def initialize(items)
|
760
|
+
# @items = items
|
761
|
+
# end
|
762
|
+
# end
|
763
|
+
# print MyClass.new([10,20,30]).render()
|
764
|
+
#
|
765
|
+
# result:
|
766
|
+
#
|
767
|
+
# <b>10</b>
|
768
|
+
#
|
769
|
+
# <b>20</b>
|
770
|
+
#
|
771
|
+
# <b>30</b>
|
772
|
+
#
|
773
|
+
# source://erb//lib/erb/def_method.rb#33
|
774
|
+
module ERB::DefMethod
|
775
|
+
private
|
776
|
+
|
777
|
+
# define _methodname_ as instance method of current module, using ERB
|
778
|
+
# object or eRuby file
|
779
|
+
#
|
780
|
+
# source://erb//lib/erb/def_method.rb#36
|
781
|
+
def def_erb_method(methodname, erb_or_fname); end
|
782
|
+
|
783
|
+
class << self
|
784
|
+
# define _methodname_ as instance method of current module, using ERB
|
785
|
+
# object or eRuby file
|
786
|
+
#
|
787
|
+
# source://erb//lib/erb/def_method.rb#46
|
788
|
+
def def_erb_method(methodname, erb_or_fname); end
|
789
|
+
end
|
790
|
+
end
|
791
|
+
|
792
|
+
module ERB::Escape; end
|
793
|
+
|
794
|
+
# :markup: markdown
|
795
|
+
#
|
796
|
+
# Placeholder constant; used as default value for certain method arguments.
|
797
|
+
#
|
798
|
+
# source://erb//lib/erb.rb#881
|
799
|
+
ERB::NOT_GIVEN = T.let(T.unsafe(nil), Object)
|
800
|
+
|
801
|
+
# ERB::Util
|
802
|
+
#
|
803
|
+
# A utility module for conversion routines, often handy in HTML generation.
|
804
|
+
#
|
805
|
+
# source://erb//lib/erb/util.rb#32
|
806
|
+
module ERB::Util
|
807
|
+
include ::ERB::Escape
|
808
|
+
|
809
|
+
private
|
810
|
+
|
811
|
+
# source://erb//lib/erb/util.rb#47
|
812
|
+
def h(_arg0); end
|
813
|
+
|
814
|
+
# cgi.gem <= v0.3.2
|
815
|
+
#
|
816
|
+
# source://erb//lib/erb/util.rb#73
|
817
|
+
def u(s); end
|
818
|
+
|
819
|
+
# cgi.gem <= v0.3.2
|
820
|
+
#
|
821
|
+
# source://erb//lib/erb/util.rb#63
|
822
|
+
def url_encode(s); end
|
823
|
+
|
824
|
+
class << self
|
825
|
+
# source://erb//lib/erb/util.rb#48
|
826
|
+
def h(_arg0); end
|
827
|
+
|
828
|
+
# source://erb//lib/erb/util.rb#46
|
829
|
+
def html_escape(_arg0); end
|
830
|
+
|
831
|
+
# cgi.gem <= v0.3.2
|
832
|
+
#
|
833
|
+
# source://erb//lib/erb/util.rb#74
|
834
|
+
def u(s); end
|
835
|
+
|
836
|
+
# cgi.gem <= v0.3.2
|
837
|
+
#
|
838
|
+
# source://erb//lib/erb/util.rb#75
|
839
|
+
def url_encode(s); end
|
840
|
+
end
|
841
|
+
end
|
842
|
+
|
843
|
+
# The string \ERB version.
|
844
|
+
#
|
845
|
+
# source://erb//lib/erb/version.rb#4
|
846
|
+
ERB::VERSION = T.let(T.unsafe(nil), String)
|