sorbet-schema 0.1.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 (89) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/.standard.yml +6 -0
  4. data/.tool-versions +1 -0
  5. data/CHANGELOG.md +24 -0
  6. data/CODE_OF_CONDUCT.md +84 -0
  7. data/Gemfile +25 -0
  8. data/Gemfile.lock +147 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +43 -0
  11. data/Rakefile +22 -0
  12. data/lib/sorbet-schema/hash_transformer.rb +22 -0
  13. data/lib/sorbet-schema/struct_ext.rb +37 -0
  14. data/lib/sorbet-schema/version.rb +5 -0
  15. data/lib/sorbet-schema.rb +27 -0
  16. data/lib/typed/coercion/coercer.rb +18 -0
  17. data/lib/typed/coercion/coercion_error.rb +7 -0
  18. data/lib/typed/coercion/coercion_not_supported_error.rb +7 -0
  19. data/lib/typed/coercion/float_coercer.rb +21 -0
  20. data/lib/typed/coercion/integer_coercer.rb +21 -0
  21. data/lib/typed/coercion/string_coercer.rb +19 -0
  22. data/lib/typed/coercion/struct_coercer.rb +26 -0
  23. data/lib/typed/coercion.rb +26 -0
  24. data/lib/typed/deserialize_error.rb +6 -0
  25. data/lib/typed/field.rb +28 -0
  26. data/lib/typed/hash_serializer.rb +21 -0
  27. data/lib/typed/json_serializer.rb +28 -0
  28. data/lib/typed/parse_error.rb +12 -0
  29. data/lib/typed/schema.rb +10 -0
  30. data/lib/typed/serializer.rb +61 -0
  31. data/lib/typed/validations/field_type_validator.rb +24 -0
  32. data/lib/typed/validations/field_validator.rb +15 -0
  33. data/lib/typed/validations/multiple_validation_error.rb +16 -0
  34. data/lib/typed/validations/required_field_error.rb +14 -0
  35. data/lib/typed/validations/type_mismatch_error.rb +14 -0
  36. data/lib/typed/validations/validated_value.rb +12 -0
  37. data/lib/typed/validations/validation_error.rb +8 -0
  38. data/lib/typed/validations/validation_results.rb +29 -0
  39. data/lib/typed/validations.rb +8 -0
  40. data/sorbet/config +5 -0
  41. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  42. data/sorbet/rbi/gems/.gitattributes +1 -0
  43. data/sorbet/rbi/gems/ansi@1.5.0.rbi +687 -0
  44. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  45. data/sorbet/rbi/gems/builder@3.2.4.rbi +504 -0
  46. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  47. data/sorbet/rbi/gems/io-console@0.7.2.rbi +8 -0
  48. data/sorbet/rbi/gems/json@2.7.1.rbi +1553 -0
  49. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  50. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +239 -0
  51. data/sorbet/rbi/gems/minitest-focus@1.4.0.rbi +91 -0
  52. data/sorbet/rbi/gems/minitest-reporters@1.6.1.rbi +1010 -0
  53. data/sorbet/rbi/gems/minitest@5.22.2.rbi +2233 -0
  54. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  55. data/sorbet/rbi/gems/parallel@1.24.0.rbi +280 -0
  56. data/sorbet/rbi/gems/parser@3.3.0.5.rbi +5472 -0
  57. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  58. data/sorbet/rbi/gems/prism@0.24.0.rbi +31040 -0
  59. data/sorbet/rbi/gems/psych@5.1.2.rbi +1731 -0
  60. data/sorbet/rbi/gems/racc@1.7.3.rbi +157 -0
  61. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  62. data/sorbet/rbi/gems/rake@13.1.0.rbi +3027 -0
  63. data/sorbet/rbi/gems/rbi@0.1.9.rbi +3006 -0
  64. data/sorbet/rbi/gems/regexp_parser@2.9.0.rbi +3771 -0
  65. data/sorbet/rbi/gems/reline@0.4.3.rbi +8 -0
  66. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
  67. data/sorbet/rbi/gems/rubocop-ast@1.31.1.rbi +7014 -0
  68. data/sorbet/rbi/gems/rubocop-performance@1.20.2.rbi +8 -0
  69. data/sorbet/rbi/gems/rubocop-sorbet@0.7.7.rbi +8 -0
  70. data/sorbet/rbi/gems/rubocop@1.61.0.rbi +57499 -0
  71. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  72. data/sorbet/rbi/gems/sorbet-result@1.1.0.rbi +519 -0
  73. data/sorbet/rbi/gems/sorbet-struct-comparable@1.3.0.rbi +34 -0
  74. data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
  75. data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +8 -0
  76. data/sorbet/rbi/gems/standard-performance@1.3.1.rbi +80 -0
  77. data/sorbet/rbi/gems/standard-sorbet@0.0.2.rbi +52 -0
  78. data/sorbet/rbi/gems/standard@1.34.0.rbi +850 -0
  79. data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
  80. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23133 -0
  81. data/sorbet/rbi/gems/tapioca@0.12.0.rbi +3499 -0
  82. data/sorbet/rbi/gems/thor@1.3.1.rbi +4351 -0
  83. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +65 -0
  84. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  85. data/sorbet/rbi/gems/yard@0.9.36.rbi +18220 -0
  86. data/sorbet/rbi/gems/zeitwerk@2.6.13.rbi +1003 -0
  87. data/sorbet/tapioca/config.yml +4 -0
  88. data/sorbet/tapioca/require.rb +12 -0
  89. metadata +191 -0
@@ -0,0 +1,504 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `builder` gem.
5
+ # Please instead update this file by running `bin/tapioca gem builder`.
6
+
7
+ # If the Builder::XChar module is not currently defined, fail on any
8
+ # name clashes in standard library classes.
9
+ #
10
+ # source://builder//lib/builder/blankslate.rb#17
11
+ module Builder
12
+ class << self
13
+ # source://builder//lib/builder/xchar.rb#13
14
+ def check_for_name_collision(klass, method_name, defined_constant = T.unsafe(nil)); end
15
+ end
16
+ end
17
+
18
+ # source://builder//lib/builder/blankslate.rb#19
19
+ Builder::BlankSlate = BasicObject
20
+
21
+ # Generic error for builder
22
+ #
23
+ # source://builder//lib/builder/xmlbase.rb#9
24
+ class Builder::IllegalBlockError < ::RuntimeError; end
25
+
26
+ # source://builder//lib/builder/xchar.rb#33
27
+ module Builder::XChar
28
+ class << self
29
+ # encode a string per XML rules
30
+ #
31
+ # source://builder//lib/builder/xchar.rb#152
32
+ def encode(string); end
33
+
34
+ # convert a string to valid UTF-8, compensating for a number of
35
+ # common errors.
36
+ #
37
+ # source://builder//lib/builder/xchar.rb#126
38
+ def unicode(string); end
39
+ end
40
+ end
41
+
42
+ # See
43
+ # http://intertwingly.net/stories/2004/04/14/i18n.html#CleaningWindows
44
+ # for details.
45
+ #
46
+ # source://builder//lib/builder/xchar.rb#38
47
+ Builder::XChar::CP1252 = T.let(T.unsafe(nil), Hash)
48
+
49
+ # source://builder//lib/builder/xchar.rb#100
50
+ Builder::XChar::CP1252_DIFFERENCES = T.let(T.unsafe(nil), String)
51
+
52
+ # source://builder//lib/builder/xchar.rb#120
53
+ Builder::XChar::ENCODING_BINARY = T.let(T.unsafe(nil), Encoding)
54
+
55
+ # source://builder//lib/builder/xchar.rb#122
56
+ Builder::XChar::ENCODING_ISO1 = T.let(T.unsafe(nil), Encoding)
57
+
58
+ # source://builder//lib/builder/xchar.rb#121
59
+ Builder::XChar::ENCODING_UTF8 = T.let(T.unsafe(nil), Encoding)
60
+
61
+ # source://builder//lib/builder/xchar.rb#109
62
+ Builder::XChar::INVALID_XML_CHAR = T.let(T.unsafe(nil), Regexp)
63
+
64
+ # See http://www.w3.org/TR/REC-xml/#dt-chardata for details.
65
+ #
66
+ # source://builder//lib/builder/xchar.rb#69
67
+ Builder::XChar::PREDEFINED = T.let(T.unsafe(nil), Hash)
68
+
69
+ # http://www.fileformat.info/info/unicode/char/fffd/index.htm
70
+ #
71
+ # source://builder//lib/builder/xchar.rb#84
72
+ Builder::XChar::REPLACEMENT_CHAR = T.let(T.unsafe(nil), String)
73
+
74
+ # source://builder//lib/builder/xchar.rb#100
75
+ Builder::XChar::UNICODE_EQUIVALENT = T.let(T.unsafe(nil), String)
76
+
77
+ # See http://www.w3.org/TR/REC-xml/#charsets for details.
78
+ #
79
+ # source://builder//lib/builder/xchar.rb#76
80
+ Builder::XChar::VALID = T.let(T.unsafe(nil), Array)
81
+
82
+ # source://builder//lib/builder/xchar.rb#105
83
+ Builder::XChar::XML_PREDEFINED = T.let(T.unsafe(nil), Regexp)
84
+
85
+ # XmlBase is a base class for building XML builders. See
86
+ # Builder::XmlMarkup and Builder::XmlEvents for examples.
87
+ #
88
+ # source://builder//lib/builder/xmlbase.rb#13
89
+ class Builder::XmlBase < ::BasicObject
90
+ # Create an XML markup builder.
91
+ #
92
+ # out :: Object receiving the markup. +out+ must respond to
93
+ # <tt><<</tt>.
94
+ # indent :: Number of spaces used for indentation (0 implies no
95
+ # indentation and no line breaks).
96
+ # initial :: Level of initial indentation.
97
+ # encoding :: When <tt>encoding</tt> and $KCODE are set to 'utf-8'
98
+ # characters aren't converted to character entities in
99
+ # the output stream.
100
+ #
101
+ # @return [XmlBase] a new instance of XmlBase
102
+ #
103
+ # source://builder//lib/builder/xmlbase.rb#29
104
+ def initialize(indent = T.unsafe(nil), initial = T.unsafe(nil), encoding = T.unsafe(nil)); end
105
+
106
+ # Append text to the output target without escaping any markup.
107
+ # May be used within the markup brackets as:
108
+ #
109
+ # builder.p { |x| x << "<br/>HI" } #=> <p><br/>HI</p>
110
+ #
111
+ # This is useful when using non-builder enabled software that
112
+ # generates strings. Just insert the string directly into the
113
+ # builder without changing the inserted markup.
114
+ #
115
+ # It is also useful for stacking builder objects. Builders only
116
+ # use <tt><<</tt> to append to the target, so by supporting this
117
+ # method/operation builders can use other builders as their
118
+ # targets.
119
+ #
120
+ # source://builder//lib/builder/xmlbase.rb#118
121
+ def <<(text); end
122
+
123
+ # @return [Boolean]
124
+ #
125
+ # source://builder//lib/builder/xmlbase.rb#35
126
+ def explicit_nil_handling?; end
127
+
128
+ # Create XML markup based on the name of the method. This method
129
+ # is never invoked directly, but is called for each markup method
130
+ # in the markup block that isn't cached.
131
+ #
132
+ # source://builder//lib/builder/xmlbase.rb#92
133
+ def method_missing(sym, *args, &block); end
134
+
135
+ # For some reason, nil? is sent to the XmlMarkup object. If nil?
136
+ # is not defined and method_missing is invoked, some strange kind
137
+ # of recursion happens. Since nil? won't ever be an XML tag, it
138
+ # is pretty safe to define it here. (Note: this is an example of
139
+ # cargo cult programming,
140
+ # cf. http://fishbowl.pastiche.org/2004/10/13/cargo_cult_programming).
141
+ #
142
+ # @return [Boolean]
143
+ #
144
+ # source://builder//lib/builder/xmlbase.rb#128
145
+ def nil?; end
146
+
147
+ # Create a tag named +sym+. Other than the first argument which
148
+ # is the tag name, the arguments are the same as the tags
149
+ # implemented via <tt>method_missing</tt>.
150
+ #
151
+ # source://builder//lib/builder/xmlbase.rb#42
152
+ def tag!(sym, *args, &block); end
153
+
154
+ # Append text to the output target. Escape any markup. May be
155
+ # used within the markup brackets as:
156
+ #
157
+ # builder.p { |b| b.br; b.text! "HI" } #=> <p><br/>HI</p>
158
+ #
159
+ # source://builder//lib/builder/xmlbase.rb#101
160
+ def text!(text); end
161
+
162
+ private
163
+
164
+ # source://builder//lib/builder/xmlbase.rb#136
165
+ def _escape(text); end
166
+
167
+ # source://builder//lib/builder/xmlbase.rb#159
168
+ def _escape_attribute(text); end
169
+
170
+ # source://builder//lib/builder/xmlbase.rb#169
171
+ def _indent; end
172
+
173
+ # source://builder//lib/builder/xmlbase.rb#174
174
+ def _nested_structures(block); end
175
+
176
+ # source://builder//lib/builder/xmlbase.rb#164
177
+ def _newline; end
178
+
179
+ # If XmlBase.cache_method_calls = true, we dynamicly create the method
180
+ # missed as an instance method on the XMLBase object. Because XML
181
+ # documents are usually very repetative in nature, the next node will
182
+ # be handled by the new method instead of method_missing. As
183
+ # method_missing is very slow, this speeds up document generation
184
+ # significantly.
185
+ #
186
+ # source://builder//lib/builder/xmlbase.rb#187
187
+ def cache_method_call(sym); end
188
+
189
+ class << self
190
+ # Returns the value of attribute cache_method_calls.
191
+ #
192
+ # source://builder//lib/builder/xmlbase.rb#16
193
+ def cache_method_calls; end
194
+
195
+ # Sets the attribute cache_method_calls
196
+ #
197
+ # @param value the value to set the attribute cache_method_calls to.
198
+ #
199
+ # source://builder//lib/builder/xmlbase.rb#16
200
+ def cache_method_calls=(_arg0); end
201
+ end
202
+ end
203
+
204
+ # Create a series of SAX-like XML events (e.g. start_tag, end_tag)
205
+ # from the markup code. XmlEvent objects are used in a way similar
206
+ # to XmlMarkup objects, except that a series of events are generated
207
+ # and passed to a handler rather than generating character-based
208
+ # markup.
209
+ #
210
+ # Usage:
211
+ # xe = Builder::XmlEvents.new(hander)
212
+ # xe.title("HI") # Sends start_tag/end_tag/text messages to the handler.
213
+ #
214
+ # Indentation may also be selected by providing value for the
215
+ # indentation size and initial indentation level.
216
+ #
217
+ # xe = Builder::XmlEvents.new(handler, indent_size, initial_indent_level)
218
+ #
219
+ # == XML Event Handler
220
+ #
221
+ # The handler object must expect the following events.
222
+ #
223
+ # [<tt>start_tag(tag, attrs)</tt>]
224
+ # Announces that a new tag has been found. +tag+ is the name of
225
+ # the tag and +attrs+ is a hash of attributes for the tag.
226
+ #
227
+ # [<tt>end_tag(tag)</tt>]
228
+ # Announces that an end tag for +tag+ has been found.
229
+ #
230
+ # [<tt>text(text)</tt>]
231
+ # Announces that a string of characters (+text+) has been found.
232
+ # A series of characters may be broken up into more than one
233
+ # +text+ call, so the client cannot assume that a single
234
+ # callback contains all the text data.
235
+ #
236
+ # source://builder//lib/builder/xmlevents.rb#49
237
+ class Builder::XmlEvents < ::Builder::XmlMarkup
238
+ # source://builder//lib/builder/xmlevents.rb#59
239
+ def _end_tag(sym); end
240
+
241
+ # source://builder//lib/builder/xmlevents.rb#54
242
+ def _start_tag(sym, attrs, end_too = T.unsafe(nil)); end
243
+
244
+ # source://builder//lib/builder/xmlevents.rb#50
245
+ def text!(text); end
246
+ end
247
+
248
+ # Create XML markup easily. All (well, almost all) methods sent to
249
+ # an XmlMarkup object will be translated to the equivalent XML
250
+ # markup. Any method with a block will be treated as an XML markup
251
+ # tag with nested markup in the block.
252
+ #
253
+ # Examples will demonstrate this easier than words. In the
254
+ # following, +xm+ is an +XmlMarkup+ object.
255
+ #
256
+ # xm.em("emphasized") # => <em>emphasized</em>
257
+ # xm.em { xm.b("emp & bold") } # => <em><b>emph &amp; bold</b></em>
258
+ # xm.a("A Link", "href"=>"http://onestepback.org")
259
+ # # => <a href="http://onestepback.org">A Link</a>
260
+ # xm.div { xm.br } # => <div><br/></div>
261
+ # xm.target("name"=>"compile", "option"=>"fast")
262
+ # # => <target option="fast" name="compile"\>
263
+ # # NOTE: order of attributes is not specified.
264
+ #
265
+ # xm.instruct! # <?xml version="1.0" encoding="UTF-8"?>
266
+ # xm.html { # <html>
267
+ # xm.head { # <head>
268
+ # xm.title("History") # <title>History</title>
269
+ # } # </head>
270
+ # xm.body { # <body>
271
+ # xm.comment! "HI" # <!-- HI -->
272
+ # xm.h1("Header") # <h1>Header</h1>
273
+ # xm.p("paragraph") # <p>paragraph</p>
274
+ # } # </body>
275
+ # } # </html>
276
+ #
277
+ # == Notes:
278
+ #
279
+ # * The order that attributes are inserted in markup tags is
280
+ # undefined.
281
+ #
282
+ # * Sometimes you wish to insert text without enclosing tags. Use
283
+ # the <tt>text!</tt> method to accomplish this.
284
+ #
285
+ # Example:
286
+ #
287
+ # xm.div { # <div>
288
+ # xm.text! "line"; xm.br # line<br/>
289
+ # xm.text! "another line"; xmbr # another line<br/>
290
+ # } # </div>
291
+ #
292
+ # * The special XML characters <, >, and & are converted to &lt;,
293
+ # &gt; and &amp; automatically. Use the <tt><<</tt> operation to
294
+ # insert text without modification.
295
+ #
296
+ # * Sometimes tags use special characters not allowed in ruby
297
+ # identifiers. Use the <tt>tag!</tt> method to handle these
298
+ # cases.
299
+ #
300
+ # Example:
301
+ #
302
+ # xml.tag!("SOAP:Envelope") { ... }
303
+ #
304
+ # will produce ...
305
+ #
306
+ # <SOAP:Envelope> ... </SOAP:Envelope>"
307
+ #
308
+ # <tt>tag!</tt> will also take text and attribute arguments (after
309
+ # the tag name) like normal markup methods. (But see the next
310
+ # bullet item for a better way to handle XML namespaces).
311
+ #
312
+ # * Direct support for XML namespaces is now available. If the
313
+ # first argument to a tag call is a symbol, it will be joined to
314
+ # the tag to produce a namespace:tag combination. It is easier to
315
+ # show this than describe it.
316
+ #
317
+ # xml.SOAP :Envelope do ... end
318
+ #
319
+ # Just put a space before the colon in a namespace to produce the
320
+ # right form for builder (e.g. "<tt>SOAP:Envelope</tt>" =>
321
+ # "<tt>xml.SOAP :Envelope</tt>")
322
+ #
323
+ # * XmlMarkup builds the markup in any object (called a _target_)
324
+ # that accepts the <tt><<</tt> method. If no target is given,
325
+ # then XmlMarkup defaults to a string target.
326
+ #
327
+ # Examples:
328
+ #
329
+ # xm = Builder::XmlMarkup.new
330
+ # result = xm.title("yada")
331
+ # # result is a string containing the markup.
332
+ #
333
+ # buffer = ""
334
+ # xm = Builder::XmlMarkup.new(buffer)
335
+ # # The markup is appended to buffer (using <<)
336
+ #
337
+ # xm = Builder::XmlMarkup.new(STDOUT)
338
+ # # The markup is written to STDOUT (using <<)
339
+ #
340
+ # xm = Builder::XmlMarkup.new
341
+ # x2 = Builder::XmlMarkup.new(:target=>xm)
342
+ # # Markup written to +x2+ will be send to +xm+.
343
+ #
344
+ # * Indentation is enabled by providing the number of spaces to
345
+ # indent for each level as a second argument to XmlBuilder.new.
346
+ # Initial indentation may be specified using a third parameter.
347
+ #
348
+ # Example:
349
+ #
350
+ # xm = Builder.new(:indent=>2)
351
+ # # xm will produce nicely formatted and indented XML.
352
+ #
353
+ # xm = Builder.new(:indent=>2, :margin=>4)
354
+ # # xm will produce nicely formatted and indented XML with 2
355
+ # # spaces per indent and an over all indentation level of 4.
356
+ #
357
+ # builder = Builder::XmlMarkup.new(:target=>$stdout, :indent=>2)
358
+ # builder.name { |b| b.first("Jim"); b.last("Weirich) }
359
+ # # prints:
360
+ # # <name>
361
+ # # <first>Jim</first>
362
+ # # <last>Weirich</last>
363
+ # # </name>
364
+ #
365
+ # * The instance_eval implementation which forces self to refer to
366
+ # the message receiver as self is now obsolete. We now use normal
367
+ # block calls to execute the markup block. This means that all
368
+ # markup methods must now be explicitly send to the xml builder.
369
+ # For instance, instead of
370
+ #
371
+ # xml.div { strong("text") }
372
+ #
373
+ # you need to write:
374
+ #
375
+ # xml.div { xml.strong("text") }
376
+ #
377
+ # Although more verbose, the subtle change in semantics within the
378
+ # block was found to be prone to error. To make this change a
379
+ # little less cumbersome, the markup block now gets the markup
380
+ # object sent as an argument, allowing you to use a shorter alias
381
+ # within the block.
382
+ #
383
+ # For example:
384
+ #
385
+ # xml_builder = Builder::XmlMarkup.new
386
+ # xml_builder.div { |xml|
387
+ # xml.stong("text")
388
+ # }
389
+ #
390
+ # source://builder//lib/builder/xmlmarkup.rb#161
391
+ class Builder::XmlMarkup < ::Builder::XmlBase
392
+ # Create an XML markup builder. Parameters are specified by an
393
+ # option hash.
394
+ #
395
+ # :target => <em>target_object</em>::
396
+ # Object receiving the markup. +target_object+ must respond to
397
+ # the <tt><<(<em>a_string</em>)</tt> operator and return
398
+ # itself. The default target is a plain string target.
399
+ #
400
+ # :indent => <em>indentation</em>::
401
+ # Number of spaces used for indentation. The default is no
402
+ # indentation and no line breaks.
403
+ #
404
+ # :margin => <em>initial_indentation_level</em>::
405
+ # Amount of initial indentation (specified in levels, not
406
+ # spaces).
407
+ #
408
+ # :quote => <em>:single</em>::
409
+ # Use single quotes for attributes rather than double quotes.
410
+ #
411
+ # :escape_attrs => <em>OBSOLETE</em>::
412
+ # The :escape_attrs option is no longer supported by builder
413
+ # (and will be quietly ignored). String attribute values are
414
+ # now automatically escaped. If you need unescaped attribute
415
+ # values (perhaps you are using entities in the attribute
416
+ # values), then give the value as a Symbol. This allows much
417
+ # finer control over escaping attribute values.
418
+ #
419
+ # @return [XmlMarkup] a new instance of XmlMarkup
420
+ #
421
+ # source://builder//lib/builder/xmlmarkup.rb#190
422
+ def initialize(options = T.unsafe(nil)); end
423
+
424
+ # Insert a CDATA section into the XML markup.
425
+ #
426
+ # For example:
427
+ #
428
+ # xml.cdata!("text to be included in cdata")
429
+ # #=> <![CDATA[text to be included in cdata]]>
430
+ #
431
+ # source://builder//lib/builder/xmlmarkup.rb#270
432
+ def cdata!(text); end
433
+
434
+ # source://builder//lib/builder/xmlmarkup.rb#275
435
+ def cdata_value!(open, text); end
436
+
437
+ # source://builder//lib/builder/xmlmarkup.rb#204
438
+ def comment!(comment_text); end
439
+
440
+ # Insert an XML declaration into the XML markup.
441
+ #
442
+ # For example:
443
+ #
444
+ # xml.declare! :ELEMENT, :blah, "yada"
445
+ # # => <!ELEMENT blah "yada">
446
+ #
447
+ # source://builder//lib/builder/xmlmarkup.rb#215
448
+ def declare!(inst, *args, &block); end
449
+
450
+ # Insert a processing instruction into the XML markup. E.g.
451
+ #
452
+ # For example:
453
+ #
454
+ # xml.instruct!
455
+ # #=> <?xml version="1.0" encoding="UTF-8"?>
456
+ # xml.instruct! :aaa, :bbb=>"ccc"
457
+ # #=> <?aaa bbb="ccc"?>
458
+ #
459
+ # Note: If the encoding is setup to "UTF-8" and the value of
460
+ # $KCODE is "UTF8", then builder will emit UTF-8 encoded strings
461
+ # rather than the entity encoding normally used.
462
+ #
463
+ # source://builder//lib/builder/xmlmarkup.rb#248
464
+ def instruct!(directive_tag = T.unsafe(nil), attrs = T.unsafe(nil)); end
465
+
466
+ # Return the target of the builder.
467
+ #
468
+ # source://builder//lib/builder/xmlmarkup.rb#200
469
+ def target!; end
470
+
471
+ private
472
+
473
+ # source://builder//lib/builder/xmlmarkup.rb#326
474
+ def _attr_value(value); end
475
+
476
+ # Insert an ending tag.
477
+ #
478
+ # source://builder//lib/builder/xmlmarkup.rb#310
479
+ def _end_tag(sym); end
480
+
481
+ # source://builder//lib/builder/xmlmarkup.rb#335
482
+ def _ensure_no_block(got_block); end
483
+
484
+ # Insert the attributes (given in the hash).
485
+ #
486
+ # source://builder//lib/builder/xmlmarkup.rb#315
487
+ def _insert_attributes(attrs, order = T.unsafe(nil)); end
488
+
489
+ # Insert special instruction.
490
+ #
491
+ # source://builder//lib/builder/xmlmarkup.rb#291
492
+ def _special(open, close, data = T.unsafe(nil), attrs = T.unsafe(nil), order = T.unsafe(nil)); end
493
+
494
+ # Start an XML tag. If <tt>end_too</tt> is true, then the start
495
+ # tag is also the end tag (e.g. <br/>
496
+ #
497
+ # source://builder//lib/builder/xmlmarkup.rb#302
498
+ def _start_tag(sym, attrs, end_too = T.unsafe(nil)); end
499
+
500
+ # Insert text directly in to the builder's target.
501
+ #
502
+ # source://builder//lib/builder/xmlmarkup.rb#286
503
+ def _text(text); end
504
+ end
@@ -0,0 +1,145 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `erubi` gem.
5
+ # Please instead update this file by running `bin/tapioca gem erubi`.
6
+
7
+ # source://erubi//lib/erubi.rb#3
8
+ module Erubi
9
+ class << self
10
+ def h(_arg0); end
11
+ end
12
+ end
13
+
14
+ # source://erubi//lib/erubi.rb#54
15
+ class Erubi::Engine
16
+ # Initialize a new Erubi::Engine. Options:
17
+ # +:bufval+ :: The value to use for the buffer variable, as a string (default <tt>'::String.new'</tt>).
18
+ # +:bufvar+ :: The variable name to use for the buffer variable, as a string.
19
+ # +:chain_appends+ :: Whether to chain <tt><<</t> calls to the buffer variable. Offers better
20
+ # performance, but can cause issues when the buffer variable is reassigned during
21
+ # template rendering (default +false+).
22
+ # +:ensure+ :: Wrap the template in a begin/ensure block restoring the previous value of bufvar.
23
+ # +:escapefunc+ :: The function to use for escaping, as a string (default: <tt>'::Erubi.h'</tt>).
24
+ # +:escape+ :: Whether to make <tt><%=</tt> escape by default, and <tt><%==</tt> not escape by default.
25
+ # +:escape_html+ :: Same as +:escape+, with lower priority.
26
+ # +:filename+ :: The filename for the template.
27
+ # the resulting source code. Note this may cause problems if you are wrapping the resulting
28
+ # source code in other code, because the magic comment only has an effect at the beginning of
29
+ # the file, and having the magic comment later in the file can trigger warnings.
30
+ # +:freeze_template_literals+ :: Whether to suffix all literal strings for template code with <tt>.freeze</tt>
31
+ # (default: +true+ on Ruby 2.1+, +false+ on Ruby 2.0 and older).
32
+ # Can be set to +false+ on Ruby 2.3+ when frozen string literals are enabled
33
+ # in order to improve performance.
34
+ # +:literal_prefix+ :: The prefix to output when using escaped tag delimiters (default <tt>'<%'</tt>).
35
+ # +:literal_postfix+ :: The postfix to output when using escaped tag delimiters (default <tt>'%>'</tt>).
36
+ # +:outvar+ :: Same as +:bufvar+, with lower priority.
37
+ # +:postamble+ :: The postamble for the template, by default returns the resulting source code.
38
+ # +:preamble+ :: The preamble for the template, by default initializes the buffer variable.
39
+ # +:regexp+ :: The regexp to use for scanning.
40
+ # +:src+ :: The initial value to use for the source code, an empty string by default.
41
+ # +:trim+ :: Whether to trim leading and trailing whitespace, true by default.
42
+ #
43
+ # @return [Engine] a new instance of Engine
44
+ #
45
+ # source://erubi//lib/erubi.rb#94
46
+ def initialize(input, properties = T.unsafe(nil)); end
47
+
48
+ # The variable name used for the buffer variable.
49
+ #
50
+ # source://erubi//lib/erubi.rb#65
51
+ def bufvar; end
52
+
53
+ # The filename of the template, if one was given.
54
+ #
55
+ # source://erubi//lib/erubi.rb#62
56
+ def filename; end
57
+
58
+ # The frozen ruby source code generated from the template, which can be evaled.
59
+ #
60
+ # source://erubi//lib/erubi.rb#59
61
+ def src; end
62
+
63
+ private
64
+
65
+ # Add ruby code to the template
66
+ #
67
+ # source://erubi//lib/erubi.rb#226
68
+ def add_code(code); end
69
+
70
+ # Add the given ruby expression result to the template,
71
+ # escaping it based on the indicator given and escape flag.
72
+ #
73
+ # source://erubi//lib/erubi.rb#235
74
+ def add_expression(indicator, code); end
75
+
76
+ # Add the result of Ruby expression to the template
77
+ #
78
+ # source://erubi//lib/erubi.rb#244
79
+ def add_expression_result(code); end
80
+
81
+ # Add the escaped result of Ruby expression to the template
82
+ #
83
+ # source://erubi//lib/erubi.rb#249
84
+ def add_expression_result_escaped(code); end
85
+
86
+ # Add the given postamble to the src. Can be overridden in subclasses
87
+ # to make additional changes to src that depend on the current state.
88
+ #
89
+ # source://erubi//lib/erubi.rb#255
90
+ def add_postamble(postamble); end
91
+
92
+ # Add raw text to the template. Modifies argument if argument is mutable as a memory optimization.
93
+ # Must be called with a string, cannot be called with nil (Rails's subclass depends on it).
94
+ #
95
+ # source://erubi//lib/erubi.rb#213
96
+ def add_text(text); end
97
+
98
+ # Raise an exception, as the base engine class does not support handling other indicators.
99
+ #
100
+ # @raise [ArgumentError]
101
+ #
102
+ # source://erubi//lib/erubi.rb#261
103
+ def handle(indicator, code, tailch, rspace, lspace); end
104
+
105
+ # Make sure that any current expression has been terminated.
106
+ # The default is to terminate all expressions, but when
107
+ # the chain_appends option is used, expressions may not be
108
+ # terminated.
109
+ #
110
+ # source://erubi//lib/erubi.rb#289
111
+ def terminate_expression; end
112
+
113
+ # Make sure the buffer variable is the target of the next append
114
+ # before yielding to the block. Mark that the buffer is the target
115
+ # of the next append after the block executes.
116
+ #
117
+ # This method should only be called if the block will result in
118
+ # code where << will append to the bufvar.
119
+ #
120
+ # source://erubi//lib/erubi.rb#271
121
+ def with_buffer; end
122
+ end
123
+
124
+ # The default regular expression used for scanning.
125
+ #
126
+ # source://erubi//lib/erubi.rb#56
127
+ Erubi::Engine::DEFAULT_REGEXP = T.let(T.unsafe(nil), Regexp)
128
+
129
+ # source://erubi//lib/erubi.rb#17
130
+ Erubi::FREEZE_TEMPLATE_LITERALS = T.let(T.unsafe(nil), TrueClass)
131
+
132
+ # source://erubi//lib/erubi.rb#15
133
+ Erubi::MATCH_METHOD = T.let(T.unsafe(nil), Symbol)
134
+
135
+ # source://erubi//lib/erubi.rb#8
136
+ Erubi::RANGE_FIRST = T.let(T.unsafe(nil), Integer)
137
+
138
+ # source://erubi//lib/erubi.rb#9
139
+ Erubi::RANGE_LAST = T.let(T.unsafe(nil), Integer)
140
+
141
+ # source://erubi//lib/erubi.rb#16
142
+ Erubi::SKIP_DEFINED_FOR_INSTANCE_VARIABLE = T.let(T.unsafe(nil), TrueClass)
143
+
144
+ # source://erubi//lib/erubi.rb#4
145
+ Erubi::VERSION = T.let(T.unsafe(nil), String)
@@ -0,0 +1,8 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `io-console` gem.
5
+ # Please instead update this file by running `bin/tapioca gem io-console`.
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem