phlex-stimulus 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 (147) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +16 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +341 -0
  6. data/Rakefile +12 -0
  7. data/lib/generators/phlex/stimulus/controller/USAGE +5 -0
  8. data/lib/generators/phlex/stimulus/controller/controller_generator.rb +49 -0
  9. data/lib/generators/phlex/stimulus/controller/templates/component.rb.erb +30 -0
  10. data/lib/generators/phlex/stimulus/controller/templates/controller.ts.erb +23 -0
  11. data/lib/generators/phlex/stimulus/generator_mixin.rb +21 -0
  12. data/lib/generators/phlex/stimulus/install/USAGE +5 -0
  13. data/lib/generators/phlex/stimulus/install/install_generator.rb +111 -0
  14. data/lib/generators/phlex/stimulus/install/templates/app/components/base.rb.erb +29 -0
  15. data/lib/generators/phlex/stimulus/install/templates/app/components/chain_controller.rb.erb +29 -0
  16. data/lib/generators/phlex/stimulus/install/templates/app/components/classlist_controller.rb.erb +30 -0
  17. data/lib/generators/phlex/stimulus/install/templates/app/components/controller.rb.erb +10 -0
  18. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_chain.rb.erb +32 -0
  19. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_template.rb.erb +24 -0
  20. data/lib/generators/phlex/stimulus/install/templates/app/components/log_controller.rb.erb +33 -0
  21. data/lib/generators/phlex/stimulus/install/templates/app/components/sleep_controller.rb.erb +30 -0
  22. data/lib/generators/phlex/stimulus/install/templates/app/components.rb.erb +7 -0
  23. data/lib/generators/phlex/stimulus/install/templates/app/javascript/application.ts.erb +5 -0
  24. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/application.ts.erb +10 -0
  25. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chain_controller.ts.erb +32 -0
  26. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chainable_controller.ts.erb +44 -0
  27. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/classlist_controller.ts.erb +30 -0
  28. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/index.ts.erb +4 -0
  29. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/log_controller.ts.erb +25 -0
  30. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/sleep_controller.ts.erb +19 -0
  31. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/typed_controller.ts.erb +53 -0
  32. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/misc.ts.erb +37 -0
  33. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/template.ts.erb +11 -0
  34. data/lib/phlex/stimulus/components/base.rb +81 -0
  35. data/lib/phlex/stimulus/components/controller.rb +170 -0
  36. data/lib/phlex/stimulus/components.rb +9 -0
  37. data/lib/phlex/stimulus/version.rb +8 -0
  38. data/lib/phlex/stimulus.rb +15 -0
  39. data/sorbet/config +7 -0
  40. data/sorbet/rbi/annotations/.gitattributes +1 -0
  41. data/sorbet/rbi/annotations/actionmailer.rbi +15 -0
  42. data/sorbet/rbi/annotations/actionpack.rbi +430 -0
  43. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  44. data/sorbet/rbi/annotations/activejob.rbi +50 -0
  45. data/sorbet/rbi/annotations/activemodel.rbi +119 -0
  46. data/sorbet/rbi/annotations/activerecord.rbi +172 -0
  47. data/sorbet/rbi/annotations/activesupport.rbi +561 -0
  48. data/sorbet/rbi/annotations/globalid.rbi +30 -0
  49. data/sorbet/rbi/annotations/minitest.rbi +116 -0
  50. data/sorbet/rbi/annotations/railties.rbi +104 -0
  51. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  52. data/sorbet/rbi/dsl/.gitattributes +1 -0
  53. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  54. data/sorbet/rbi/gems/.gitattributes +1 -0
  55. data/sorbet/rbi/gems/action_text-trix@2.1.19.rbi +9 -0
  56. data/sorbet/rbi/gems/actioncable@8.1.3.rbi +9 -0
  57. data/sorbet/rbi/gems/actionmailbox@8.1.3.rbi +9 -0
  58. data/sorbet/rbi/gems/actionmailer@8.1.3.rbi +9 -0
  59. data/sorbet/rbi/gems/actionpack@8.1.3.rbi +20478 -0
  60. data/sorbet/rbi/gems/actiontext@8.1.3.rbi +9 -0
  61. data/sorbet/rbi/gems/actionview@8.1.3.rbi +14722 -0
  62. data/sorbet/rbi/gems/activejob@8.1.3.rbi +9 -0
  63. data/sorbet/rbi/gems/activemodel@8.1.3.rbi +9 -0
  64. data/sorbet/rbi/gems/activerecord@8.1.3.rbi +9 -0
  65. data/sorbet/rbi/gems/activestorage@8.1.3.rbi +9 -0
  66. data/sorbet/rbi/gems/activesupport@8.1.3.rbi +20153 -0
  67. data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
  68. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  69. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +621 -0
  70. data/sorbet/rbi/gems/booleans@0.1.3.rbi +31 -0
  71. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  72. data/sorbet/rbi/gems/byebug@12.0.0.rbi +49 -0
  73. data/sorbet/rbi/gems/concurrent-ruby@1.3.8.rbi +10656 -0
  74. data/sorbet/rbi/gems/connection_pool@3.0.2.rbi +9 -0
  75. data/sorbet/rbi/gems/crass@1.0.7.rbi +648 -0
  76. data/sorbet/rbi/gems/date@3.5.1.rbi +391 -0
  77. data/sorbet/rbi/gems/drb@2.2.3.rbi +9 -0
  78. data/sorbet/rbi/gems/erb@6.0.6.rbi +1600 -0
  79. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  80. data/sorbet/rbi/gems/globalid@1.4.0.rbi +9 -0
  81. data/sorbet/rbi/gems/i18n@1.15.2.rbi +2285 -0
  82. data/sorbet/rbi/gems/io-console@0.8.2.rbi +9 -0
  83. data/sorbet/rbi/gems/json@2.21.1.rbi +2289 -0
  84. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  85. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  86. data/sorbet/rbi/gems/loofah@2.25.2.rbi +1134 -0
  87. data/sorbet/rbi/gems/mail@2.9.1.rbi +9 -0
  88. data/sorbet/rbi/gems/marcel@1.2.1.rbi +9 -0
  89. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
  90. data/sorbet/rbi/gems/minitest@6.0.6.rbi +1482 -0
  91. data/sorbet/rbi/gems/net-imap@0.6.4.1.rbi +9 -0
  92. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
  93. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +244 -0
  94. data/sorbet/rbi/gems/net-smtp@0.5.1.rbi +9 -0
  95. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  96. data/sorbet/rbi/gems/nio4r@2.7.5.rbi +9 -0
  97. data/sorbet/rbi/gems/nokogiri@1.19.4.rbi +8168 -0
  98. data/sorbet/rbi/gems/parallel@1.28.0.rbi +270 -0
  99. data/sorbet/rbi/gems/phlex-rails@2.4.0.rbi +1945 -0
  100. data/sorbet/rbi/gems/phlex@2.4.1.rbi +1413 -0
  101. data/sorbet/rbi/gems/pp@0.6.4.rbi +387 -0
  102. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +455 -0
  103. data/sorbet/rbi/gems/prism@1.9.0.rbi +42226 -0
  104. data/sorbet/rbi/gems/racc@1.8.1.rbi +165 -0
  105. data/sorbet/rbi/gems/rack-session@2.1.2.rbi +756 -0
  106. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +681 -0
  107. data/sorbet/rbi/gems/rack@3.2.6.rbi +4653 -0
  108. data/sorbet/rbi/gems/rackup@2.3.1.rbi +9 -0
  109. data/sorbet/rbi/gems/rails-dom-testing@2.3.0.rbi +517 -0
  110. data/sorbet/rbi/gems/rails-html-sanitizer@1.7.1.rbi +620 -0
  111. data/sorbet/rbi/gems/rails@8.1.3.rbi +9 -0
  112. data/sorbet/rbi/gems/railties@8.1.3.rbi +3507 -0
  113. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  114. data/sorbet/rbi/gems/rake@13.4.2.rbi +3130 -0
  115. data/sorbet/rbi/gems/rbi@0.4.0.rbi +5706 -0
  116. data/sorbet/rbi/gems/rbs@4.0.3.rbi +6908 -0
  117. data/sorbet/rbi/gems/refract@1.1.0.rbi +9 -0
  118. data/sorbet/rbi/gems/reline@0.6.3.rbi +2446 -0
  119. data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
  120. data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
  121. data/sorbet/rbi/gems/rubocop-espago@1.3.0.rbi +9 -0
  122. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  123. data/sorbet/rbi/gems/rubydex@0.2.9.rbi +841 -0
  124. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  125. data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +544 -0
  126. data/sorbet/rbi/gems/spoom@1.8.4.rbi +6738 -0
  127. data/sorbet/rbi/gems/tapioca@0.19.2.rbi +3599 -0
  128. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  129. data/sorbet/rbi/gems/timeout@0.6.1.rbi +200 -0
  130. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  131. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5474 -0
  132. data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +130 -0
  133. data/sorbet/rbi/gems/unicode-emoji@4.2.0.rbi +332 -0
  134. data/sorbet/rbi/gems/uri@1.1.1.rbi +2402 -0
  135. data/sorbet/rbi/gems/useragent@0.16.11.rbi +9 -0
  136. data/sorbet/rbi/gems/websocket-driver@0.8.2.rbi +9 -0
  137. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
  138. data/sorbet/rbi/gems/zeitwerk@2.8.2.rbi +9 -0
  139. data/sorbet/rbi/shims/gems/parser.rbi +12 -0
  140. data/sorbet/rbi/shims/gems/rails.rbi +55 -0
  141. data/sorbet/rbi/shims/gems/refract.rbi +13 -0
  142. data/sorbet/rbi/shims/gems/shoulda-context.rbi +16 -0
  143. data/sorbet/tapioca/compilers/phlex_controller.rb +80 -0
  144. data/sorbet/tapioca/config.yml +26 -0
  145. data/sorbet/tapioca/extensions/load_gem.rb +1 -0
  146. data/sorbet/tapioca/require.rb +4 -0
  147. metadata +266 -0
@@ -0,0 +1,1600 @@
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
+ # :markup: markdown
9
+ #
10
+ # Class **ERB** (the name stands for **Embedded Ruby**)
11
+ # is an easy-to-use, but also very powerful, [template processor][template processor].
12
+ #
13
+ # ## Usage
14
+ #
15
+ # Before you can use \ERB, you must first require it
16
+ # (examples on this page assume that this has been done):
17
+ #
18
+ # ```
19
+ # require 'erb'
20
+ # ```
21
+ #
22
+ # ## In Brief
23
+ #
24
+ # Here's how \ERB works:
25
+ #
26
+ # - You can create a *template*: a plain-text string that includes specially formatted *tags*.
27
+ # - You can create an \ERB object to store the template.
28
+ # - You can call instance method ERB#result to get the *result*.
29
+ #
30
+ # \ERB supports tags of three kinds:
31
+ #
32
+ # - [Expression tags][expression tags]:
33
+ # each begins with `'<%='`, ends with `'%>'`; contains a Ruby expression;
34
+ # in the result, the value of the expression replaces the entire tag:
35
+ #
36
+ # ```
37
+ # template = 'The magic word is <%= magic_word %>.'
38
+ # erb = ERB.new(template)
39
+ # magic_word = 'xyzzy'
40
+ # erb.result(binding) # => "The magic word is xyzzy."
41
+ # ```
42
+ #
43
+ # The above call to #result passes argument `binding`,
44
+ # which contains the binding of variable `magic_word` to its string value `'xyzzy'`.
45
+ #
46
+ # The below call to #result need not pass a binding,
47
+ # because its expression `Date::DAYNAMES` is globally defined.
48
+ #
49
+ # ```
50
+ # ERB.new('Today is <%= Date::DAYNAMES[Date.today.wday] %>.').result # => "Today is Monday."
51
+ # ```
52
+ #
53
+ # - [Execution tags][execution tags]:
54
+ # each begins with `'<%'`, ends with `'%>'`; contains Ruby code to be executed:
55
+ #
56
+ # ```
57
+ # template = '<% File.write("t.txt", "Some stuff.") %>'
58
+ # ERB.new(template).result
59
+ # File.read('t.txt') # => "Some stuff."
60
+ # ```
61
+ #
62
+ # - [Comment tags][comment tags]:
63
+ # each begins with `'<%#'`, ends with `'%>'`; contains comment text;
64
+ # in the result, the entire tag is omitted.
65
+ #
66
+ # ```
67
+ # template = 'Some stuff;<%# Note to self: figure out what the stuff is. %> more stuff.'
68
+ # ERB.new(template).result # => "Some stuff; more stuff."
69
+ # ```
70
+ #
71
+ # ## Some Simple Examples
72
+ #
73
+ # Here's a simple example of \ERB in action:
74
+ #
75
+ # ```
76
+ # template = 'The time is <%= Time.now %>.'
77
+ # erb = ERB.new(template)
78
+ # erb.result
79
+ # # => "The time is 2025-09-09 10:49:26 -0500."
80
+ # ```
81
+ #
82
+ # Details:
83
+ #
84
+ # 1. A plain-text string is assigned to variable `template`.
85
+ # Its embedded [expression tag][expression tags] `'<%= Time.now %>'` includes a Ruby expression, `Time.now`.
86
+ # 2. The string is put into a new \ERB object, and stored in variable `erb`.
87
+ # 3. Method call `erb.result` generates a string that contains the run-time value of `Time.now`,
88
+ # as computed at the time of the call.
89
+ #
90
+ # The \ERB object may be re-used:
91
+ #
92
+ # ```
93
+ # erb.result
94
+ # # => "The time is 2025-09-09 10:49:33 -0500."
95
+ # ```
96
+ #
97
+ # Another example:
98
+ #
99
+ # ```
100
+ # template = 'The magic word is <%= magic_word %>.'
101
+ # erb = ERB.new(template)
102
+ # magic_word = 'abracadabra'
103
+ # erb.result(binding)
104
+ # # => "The magic word is abracadabra."
105
+ # ```
106
+ #
107
+ # Details:
108
+ #
109
+ # 1. As before, a plain-text string is assigned to variable `template`.
110
+ # Its embedded [expression tag][expression tags] `'<%= magic_word %>'` has a variable *name*, `magic_word`.
111
+ # 2. The string is put into a new \ERB object, and stored in variable `erb`;
112
+ # note that `magic_word` need not be defined before the \ERB object is created.
113
+ # 3. `magic_word = 'abracadabra'` assigns a value to variable `magic_word`.
114
+ # 4. Method call `erb.result(binding)` generates a string
115
+ # that contains the *value* of `magic_word`.
116
+ #
117
+ # As before, the \ERB object may be re-used:
118
+ #
119
+ # ```
120
+ # magic_word = 'xyzzy'
121
+ # erb.result(binding)
122
+ # # => "The magic word is xyzzy."
123
+ # ```
124
+ #
125
+ # ## Bindings
126
+ #
127
+ # A call to method #result, which produces the formatted result string,
128
+ # requires a [`Binding` object][binding object] as its argument.
129
+ #
130
+ # The binding object provides the bindings for expressions in [expression tags][expression tags].
131
+ #
132
+ # There are three ways to provide the required binding:
133
+ #
134
+ # - [Default binding][default binding]
135
+ # - [Local binding][local binding]
136
+ # - [Augmented binding][augmented binding]
137
+ #
138
+ # ### Default Binding
139
+ #
140
+ # When you pass no `binding` argument to method #result,
141
+ # the method uses its default binding: the one returned by method #new_toplevel.
142
+ # This binding has the bindings defined by Ruby itself,
143
+ # which are those for Ruby's constants and variables.
144
+ #
145
+ # That binding is sufficient for an expression tag that refers only to Ruby's constants and variables;
146
+ # these expression tags refer only to Ruby's global constant `RUBY_COPYRIGHT` and global variable `$0`:
147
+ #
148
+ # ```
149
+ # template = <<TEMPLATE
150
+ # The Ruby copyright is <%= RUBY_COPYRIGHT.inspect %>.
151
+ # The current process is <%= $0 %>.
152
+ # TEMPLATE
153
+ # puts ERB.new(template).result
154
+ # ```
155
+ #
156
+ # ```
157
+ # The Ruby copyright is "ruby - Copyright (C) 1993-2025 Yukihiro Matsumoto".
158
+ # The current process is irb.
159
+ # ```
160
+ #
161
+ # (The current process is `irb` because that's where we're doing these examples!)
162
+ #
163
+ # ### Local Binding
164
+ #
165
+ # The default binding is *not* sufficient for an expression
166
+ # that refers to a constant or variable that is not defined there:
167
+ #
168
+ # ```
169
+ # Foo = 1 # Defines local constant Foo.
170
+ # foo = 2 # Defines local variable foo.
171
+ # template = <<TEMPLATE
172
+ # The current value of constant Foo is <%= Foo %>.
173
+ # The current value of variable foo is <%= foo %>.
174
+ # The Ruby copyright is <%= RUBY_COPYRIGHT.inspect %>.
175
+ # The current process is <%= $0 %>.
176
+ # TEMPLATE
177
+ # erb = ERB.new(template)
178
+ # ```
179
+ #
180
+ # This call below raises `NameError` because although `Foo` and `foo` are defined locally,
181
+ # they are not defined in the default binding:
182
+ #
183
+ # ```
184
+ # erb.result # Raises NameError.
185
+ # ```
186
+ #
187
+ # To make the locally-defined constants and variables available,
188
+ # you can call #result with the local binding:
189
+ #
190
+ # ```
191
+ # puts erb.result(binding)
192
+ # ```
193
+ #
194
+ # ```
195
+ # The current value of constant Foo is 1.
196
+ # The current value of variable foo is 2.
197
+ # The Ruby copyright is "ruby - Copyright (C) 1993-2025 Yukihiro Matsumoto".
198
+ # The current process is irb.
199
+ # ```
200
+ #
201
+ # ### Augmented Binding
202
+ #
203
+ # Another way to make variable bindings (but not constant bindings) available
204
+ # is to use method #result_with_hash(hash);
205
+ # the passed hash has name/value pairs that are to be used to define and assign variables
206
+ # in a copy of the default binding:
207
+ #
208
+ # ```
209
+ # template = <<TEMPLATE
210
+ # The current value of variable bar is <%= bar %>.
211
+ # The current value of variable baz is <%= baz %>.
212
+ # The Ruby copyright is <%= RUBY_COPYRIGHT.inspect %>.
213
+ # The current process is <%= $0 %>.
214
+ # TEMPLATE
215
+ # erb = ERB.new(template)
216
+ # ```
217
+ #
218
+ # Both of these calls raise `NameError`, because `bar` and `baz`
219
+ # are not defined in either the default binding or the local binding.
220
+ #
221
+ # ```
222
+ # puts erb.result # Raises NameError.
223
+ # puts erb.result(binding) # Raises NameError.
224
+ # ```
225
+ #
226
+ # This call passes a hash that causes `bar` and `baz` to be defined
227
+ # in a new binding (derived from #new_toplevel):
228
+ #
229
+ # ```
230
+ # hash = {bar: 3, baz: 4}
231
+ # puts erb.result_with_hash(hash)
232
+ # ```
233
+ #
234
+ # ```
235
+ # The current value of variable bar is 3.
236
+ # The current value of variable baz is 4.
237
+ # The Ruby copyright is "ruby - Copyright (C) 1993-2025 Yukihiro Matsumoto".
238
+ # The current process is irb.
239
+ # ```
240
+ #
241
+ # ## Tags
242
+ #
243
+ # The examples above use expression tags.
244
+ # These are the tags available in \ERB:
245
+ #
246
+ # - [Expression tag][expression tags]: the tag contains a Ruby expression;
247
+ # in the result, the entire tag is to be replaced with the run-time value of the expression.
248
+ # - [Execution tag][execution tags]: the tag contains Ruby code;
249
+ # in the result, the entire tag is to be replaced with the run-time value of the code.
250
+ # - [Comment tag][comment tags]: the tag contains comment code;
251
+ # in the result, the entire tag is to be omitted.
252
+ #
253
+ # ### Expression Tags
254
+ #
255
+ # You can embed a Ruby expression in a template using an *expression tag*.
256
+ #
257
+ # Its syntax is `<%= expression %>`,
258
+ # where *expression* is any valid Ruby expression.
259
+ #
260
+ # When you call method #result,
261
+ # the method evaluates the expression and replaces the entire expression tag with the expression's value:
262
+ #
263
+ # ```
264
+ # ERB.new('Today is <%= Date::DAYNAMES[Date.today.wday] %>.').result
265
+ # # => "Today is Monday."
266
+ # ERB.new('Tomorrow will be <%= Date::DAYNAMES[Date.today.wday + 1] %>.').result
267
+ # # => "Tomorrow will be Tuesday."
268
+ # ERB.new('Yesterday was <%= Date::DAYNAMES[Date.today.wday - 1] %>.').result
269
+ # # => "Yesterday was Sunday."
270
+ # ```
271
+ #
272
+ # Note that whitespace before and after the expression
273
+ # is allowed but not required,
274
+ # and that such whitespace is stripped from the result.
275
+ #
276
+ # ```
277
+ # ERB.new('My appointment is on <%=Date::DAYNAMES[Date.today.wday + 2]%>.').result
278
+ # # => "My appointment is on Wednesday."
279
+ # ERB.new('My appointment is on <%= Date::DAYNAMES[Date.today.wday + 2] %>.').result
280
+ # # => "My appointment is on Wednesday."
281
+ # ```
282
+ #
283
+ # ### Execution Tags
284
+ #
285
+ # You can embed Ruby executable code in template using an *execution tag*.
286
+ #
287
+ # Its syntax is `<% code %>`,
288
+ # where *code* is any valid Ruby code.
289
+ #
290
+ # When you call method #result,
291
+ # the method executes the code and removes the entire execution tag
292
+ # (generating no text in the result):
293
+ #
294
+ # ```
295
+ # ERB.new('foo <% Dir.chdir(Dir.pwd) %> bar').result # => "foo bar"
296
+ # ```
297
+ #
298
+ # Whitespace before and after the embedded code is optional:
299
+ #
300
+ # ```
301
+ # ERB.new('foo <%Dir.chdir(Dir.pwd)%> bar').result # => "foo bar"
302
+ # ```
303
+ #
304
+ # You can interleave text with execution tags to form a control structure
305
+ # such as a conditional, a loop, or a `case` statement.
306
+ #
307
+ # Conditional:
308
+ #
309
+ # ```
310
+ # template = <<TEMPLATE
311
+ # <% if verbosity %>
312
+ # An error has occurred.
313
+ # <% else %>
314
+ # Oops!
315
+ # <% end %>
316
+ # TEMPLATE
317
+ # erb = ERB.new(template)
318
+ # verbosity = true
319
+ # erb.result(binding)
320
+ # # => "\nAn error has occurred.\n\n"
321
+ # verbosity = false
322
+ # erb.result(binding)
323
+ # # => "\nOops!\n\n"
324
+ # ```
325
+ #
326
+ # Note that the interleaved text may itself contain expression tags:
327
+ #
328
+ # Loop:
329
+ #
330
+ # ```
331
+ # template = <<TEMPLATE
332
+ # <% Date::ABBR_DAYNAMES.each do |dayname| %>
333
+ # <%= dayname %>
334
+ # <% end %>
335
+ # TEMPLATE
336
+ # ERB.new(template).result
337
+ # # => "\nSun\n\nMon\n\nTue\n\nWed\n\nThu\n\nFri\n\nSat\n\n"
338
+ # ```
339
+ #
340
+ # Other, non-control, lines of Ruby code may be interleaved with the text,
341
+ # and the Ruby code may itself contain regular Ruby comments:
342
+ #
343
+ # ```
344
+ # template = <<TEMPLATE
345
+ # <% 3.times do %>
346
+ # <%= Time.now %>
347
+ # <% sleep(1) # Let's make the times different. %>
348
+ # <% end %>
349
+ # TEMPLATE
350
+ # ERB.new(template).result
351
+ # # => "\n2025-09-09 11:36:02 -0500\n\n\n2025-09-09 11:36:03 -0500\n\n\n2025-09-09 11:36:04 -0500\n\n\n"
352
+ # ```
353
+ #
354
+ # The execution tag may also contain multiple lines of code:
355
+ #
356
+ # ```
357
+ # template = <<TEMPLATE
358
+ # <%
359
+ # (0..2).each do |i|
360
+ # (0..2).each do |j|
361
+ # %>
362
+ # * <%=i%>,<%=j%>
363
+ # <%
364
+ # end
365
+ # end
366
+ # %>
367
+ # TEMPLATE
368
+ # ERB.new(template).result
369
+ # # => "\n* 0,0\n\n* 0,1\n\n* 0,2\n\n* 1,0\n\n* 1,1\n\n* 1,2\n\n* 2,0\n\n* 2,1\n\n* 2,2\n\n"
370
+ # ```
371
+ #
372
+ # #### Shorthand Format for Execution Tags
373
+ #
374
+ # You can use keyword argument `trim_mode: '%'` to enable a shorthand format for execution tags;
375
+ # this example uses the shorthand format `% code` instead of `<% code %>`:
376
+ #
377
+ # ```
378
+ # template = <<TEMPLATE
379
+ # % priorities.each do |priority|
380
+ # * <%= priority %>
381
+ # % end
382
+ # TEMPLATE
383
+ # erb = ERB.new(template, trim_mode: '%')
384
+ # priorities = [ 'Run Ruby Quiz',
385
+ # 'Document Modules',
386
+ # 'Answer Questions on Ruby Talk' ]
387
+ # puts erb.result(binding)
388
+ # ```
389
+ #
390
+ # ```
391
+ # * Run Ruby Quiz
392
+ # * Document Modules
393
+ # * Answer Questions on Ruby Talk
394
+ # ```
395
+ #
396
+ # Note that in the shorthand format, the character `'%'` must be the first character in the code line
397
+ # (no leading whitespace).
398
+ #
399
+ # #### Suppressing Unwanted Blank Lines
400
+ #
401
+ # With keyword argument `trim_mode` not given,
402
+ # all blank lines go into the result:
403
+ #
404
+ # ```
405
+ # template = <<TEMPLATE
406
+ # <% if true %>
407
+ # <%= RUBY_VERSION %>
408
+ # <% end %>
409
+ # TEMPLATE
410
+ # ERB.new(template).result.lines.each {|line| puts line.inspect }
411
+ # ```
412
+ #
413
+ # ```
414
+ # "\n"
415
+ # "3.4.5\n"
416
+ # "\n"
417
+ # ```
418
+ #
419
+ # If you give `trim_mode: '-'`, you can suppress each blank line
420
+ # whose source line ends with `-%>` (instead of `%>`):
421
+ #
422
+ # ```
423
+ # template = <<TEMPLATE
424
+ # <% if true -%>
425
+ # <%= RUBY_VERSION %>
426
+ # <% end -%>
427
+ # TEMPLATE
428
+ # ERB.new(template, trim_mode: '-').result.lines.each {|line| puts line.inspect }
429
+ # ```
430
+ #
431
+ # ```
432
+ # "3.4.5\n"
433
+ # ```
434
+ #
435
+ # It is an error to use the trailing `'-%>'` notation without `trim_mode: '-'`:
436
+ #
437
+ # ```
438
+ # ERB.new(template).result.lines.each {|line| puts line.inspect } # Raises SyntaxError.
439
+ # ```
440
+ #
441
+ # #### Suppressing Unwanted Newlines
442
+ #
443
+ # Consider this template:
444
+ #
445
+ # ```
446
+ # template = <<TEMPLATE
447
+ # <% RUBY_VERSION %>
448
+ # <%= RUBY_VERSION %>
449
+ # foo <% RUBY_VERSION %>
450
+ # foo <%= RUBY_VERSION %>
451
+ # TEMPLATE
452
+ # ```
453
+ #
454
+ # With keyword argument `trim_mode` not given, all newlines go into the result:
455
+ #
456
+ # ```
457
+ # ERB.new(template).result.lines.each {|line| puts line.inspect }
458
+ # ```
459
+ #
460
+ # ```
461
+ # "\n"
462
+ # "3.4.5\n"
463
+ # "foo \n"
464
+ # "foo 3.4.5\n"
465
+ # ```
466
+ #
467
+ # You can give `trim_mode: '>'` to suppress the trailing newline
468
+ # for each line that ends with `'%>'` (regardless of its beginning):
469
+ #
470
+ # ```
471
+ # ERB.new(template, trim_mode: '>').result.lines.each {|line| puts line.inspect }
472
+ # ```
473
+ #
474
+ # ```
475
+ # "3.4.5foo foo 3.4.5"
476
+ # ```
477
+ #
478
+ # You can give `trim_mode: '<>'` to suppress the trailing newline
479
+ # for each line that both begins with `'<%'` and ends with `'%>'`:
480
+ #
481
+ # ```
482
+ # ERB.new(template, trim_mode: '<>').result.lines.each {|line| puts line.inspect }
483
+ # ```
484
+ #
485
+ # ```
486
+ # "3.4.5foo \n"
487
+ # "foo 3.4.5\n"
488
+ # ```
489
+ #
490
+ # #### Combining Trim Modes
491
+ #
492
+ # You can combine certain trim modes:
493
+ #
494
+ # - `'%-'`: Enable shorthand and omit each blank line ending with `'-%>'`.
495
+ # - `'%>'`: Enable shorthand and omit newline for each line ending with `'%>'`.
496
+ # - `'%<>'`: Enable shorthand and omit newline for each line starting with `'<%'` and ending with `'%>'`.
497
+ #
498
+ # ### Comment Tags
499
+ #
500
+ # You can embed a comment in a template using a *comment tag*;
501
+ # its syntax is `<%# text %>`,
502
+ # where *text* is the text of the comment.
503
+ #
504
+ # When you call method #result,
505
+ # it removes the entire comment tag
506
+ # (generating no text in the result).
507
+ #
508
+ # Example:
509
+ #
510
+ # ```
511
+ # template = 'Some stuff;<%# Note to self: figure out what the stuff is. %> more stuff.'
512
+ # ERB.new(template).result # => "Some stuff; more stuff."
513
+ # ```
514
+ #
515
+ # A comment tag may appear anywhere in the template.
516
+ #
517
+ # Note that the beginning of the tag must be `'<%#'`, not `'<% #'`.
518
+ #
519
+ # In this example, the tag begins with `'<% #'`, and so is an execution tag, not a comment tag;
520
+ # the cited code consists entirely of a Ruby-style comment (which is of course ignored):
521
+ #
522
+ # ```
523
+ # ERB.new('Some stuff;<% # Note to self: figure out what the stuff is. %> more stuff.').result
524
+ # # => "Some stuff;"
525
+ # ```
526
+ #
527
+ # ## Encodings
528
+ #
529
+ # An \ERB object has an [encoding][encoding],
530
+ # which is by default the encoding of the template string;
531
+ # the result string will also have that encoding.
532
+ #
533
+ # ```
534
+ # template = <<TEMPLATE
535
+ # <%# Comment. %>
536
+ # TEMPLATE
537
+ # erb = ERB.new(template)
538
+ # template.encoding # => #<Encoding:UTF-8>
539
+ # erb.encoding # => #<Encoding:UTF-8>
540
+ # erb.result.encoding # => #<Encoding:UTF-8>
541
+ # ```
542
+ #
543
+ # You can specify a different encoding by adding a [magic comment][magic comments]
544
+ # at the top of the given template:
545
+ #
546
+ # ```
547
+ # template = <<TEMPLATE
548
+ # <%#-*- coding: Big5 -*-%>
549
+ # <%# Comment. %>
550
+ # TEMPLATE
551
+ # erb = ERB.new(template)
552
+ # template.encoding # => #<Encoding:UTF-8>
553
+ # erb.encoding # => #<Encoding:Big5>
554
+ # erb.result.encoding # => #<Encoding:Big5>
555
+ # ```
556
+ #
557
+ # ## Error Reporting
558
+ #
559
+ # Consider this template (containing an error):
560
+ #
561
+ # ```
562
+ # template = '<%= nosuch %>'
563
+ # erb = ERB.new(template)
564
+ # ```
565
+ #
566
+ # When \ERB reports an error,
567
+ # it includes a file name (if available) and a line number;
568
+ # the file name comes from method #filename, the line number from method #lineno.
569
+ #
570
+ # Initially, those values are `nil` and `0`, respectively;
571
+ # these initial values are reported as `'(erb)'` and `1`, respectively:
572
+ #
573
+ # ```
574
+ # erb.filename # => nil
575
+ # erb.lineno # => 0
576
+ # erb.result
577
+ # # => (erb):1:in '<main>': undefined local variable or method 'nosuch' for main (NameError)
578
+ # ```
579
+ #
580
+ # You can use methods #filename= and #lineno= to assign values
581
+ # that are more meaningful in your context:
582
+ #
583
+ # ```
584
+ # erb.filename = 't.txt'
585
+ # erb.lineno = 555
586
+ # erb.result
587
+ # # => t.txt:556:in '<main>': undefined local variable or method 'nosuch' for main (NameError)
588
+ # ```
589
+ #
590
+ # You can use method #location= to set both values:
591
+ #
592
+ # ```
593
+ # erb.location = ['u.txt', 999]
594
+ # erb.result
595
+ # # => u.txt:1000:in '<main>': undefined local variable or method 'nosuch' for main (NameError)
596
+ # ```
597
+ #
598
+ # ## Plain Text with Embedded Ruby
599
+ #
600
+ # Here's a plain-text template;
601
+ # it uses the literal notation `'%q{ ... }'` to define the template
602
+ # (see [%q literals][%q literals]);
603
+ # this avoids problems with backslashes.
604
+ #
605
+ # ```
606
+ # template = %q{
607
+ # From: James Edward Gray II <james@grayproductions.net>
608
+ # To: <%= to %>
609
+ # Subject: Addressing Needs
610
+ #
611
+ # <%= to[/\w+/] %>:
612
+ #
613
+ # Just wanted to send a quick note assuring that your needs are being
614
+ # addressed.
615
+ #
616
+ # I want you to know that my team will keep working on the issues,
617
+ # especially:
618
+ #
619
+ # <%# ignore numerous minor requests -- focus on priorities %>
620
+ # % priorities.each do |priority|
621
+ # * <%= priority %>
622
+ # % end
623
+ #
624
+ # Thanks for your patience.
625
+ #
626
+ # James Edward Gray II
627
+ # }
628
+ # ```
629
+ #
630
+ # The template will need these:
631
+ #
632
+ # ```
633
+ # to = 'Community Spokesman <spokesman@ruby_community.org>'
634
+ # priorities = [ 'Run Ruby Quiz',
635
+ # 'Document Modules',
636
+ # 'Answer Questions on Ruby Talk' ]
637
+ # ```
638
+ #
639
+ # Finally, create the \ERB object and get the result:
640
+ #
641
+ # ```
642
+ # erb = ERB.new(template, trim_mode: '%<>')
643
+ # puts erb.result(binding)
644
+ # ```
645
+ #
646
+ # ```
647
+ # From: James Edward Gray II <james@grayproductions.net>
648
+ # To: Community Spokesman <spokesman@ruby_community.org>
649
+ # Subject: Addressing Needs
650
+ #
651
+ # Community:
652
+ #
653
+ # Just wanted to send a quick note assuring that your needs are being
654
+ # addressed.
655
+ #
656
+ # I want you to know that my team will keep working on the issues,
657
+ # especially:
658
+ #
659
+ # * Run Ruby Quiz
660
+ # * Document Modules
661
+ # * Answer Questions on Ruby Talk
662
+ #
663
+ # Thanks for your patience.
664
+ #
665
+ # James Edward Gray II
666
+ # ```
667
+ #
668
+ # ## HTML with Embedded Ruby
669
+ #
670
+ # This example shows an HTML template.
671
+ #
672
+ # First, here's a custom class, `Product`:
673
+ #
674
+ # ```
675
+ # class Product
676
+ # def initialize(code, name, desc, cost)
677
+ # @code = code
678
+ # @name = name
679
+ # @desc = desc
680
+ # @cost = cost
681
+ # @features = []
682
+ # end
683
+ #
684
+ # def add_feature(feature)
685
+ # @features << feature
686
+ # end
687
+ #
688
+ # # Support templating of member data.
689
+ # def get_binding
690
+ # binding
691
+ # end
692
+ # end
693
+ # ```
694
+ #
695
+ # The template below will need these values:
696
+ #
697
+ # ```
698
+ # toy = Product.new('TZ-1002',
699
+ # 'Rubysapien',
700
+ # "Geek's Best Friend! Responds to Ruby commands...",
701
+ # 999.95)
702
+ # toy.add_feature('Listens for verbal commands in the Ruby language!')
703
+ # toy.add_feature('Ignores Perl, Java, and all C variants.')
704
+ # toy.add_feature('Karate-Chop Action!!!')
705
+ # toy.add_feature('Matz signature on left leg.')
706
+ # toy.add_feature('Gem studded eyes... Rubies, of course!')
707
+ # ```
708
+ #
709
+ # Here's the HTML:
710
+ #
711
+ # ```
712
+ # template = <<TEMPLATE
713
+ # <html>
714
+ # <head><title>Ruby Toys -- <%= @name %></title></head>
715
+ # <body>
716
+ # <h1><%= @name %> (<%= @code %>)</h1>
717
+ # <p><%= @desc %></p>
718
+ # <ul>
719
+ # <% @features.each do |f| %>
720
+ # <li><b><%= f %></b></li>
721
+ # <% end %>
722
+ # </ul>
723
+ # <p>
724
+ # <% if @cost < 10 %>
725
+ # <b>Only <%= @cost %>!!!</b>
726
+ # <% else %>
727
+ # Call for a price, today!
728
+ # <% end %>
729
+ # </p>
730
+ # </body>
731
+ # </html>
732
+ # TEMPLATE
733
+ # ```
734
+ #
735
+ # Finally, create the \ERB object and get the result (omitting some blank lines):
736
+ #
737
+ # ```
738
+ # erb = ERB.new(template)
739
+ # puts erb.result(toy.get_binding)
740
+ # ```
741
+ #
742
+ # ```html
743
+ # <html>
744
+ # <head><title>Ruby Toys -- Rubysapien</title></head>
745
+ # <body>
746
+ # <h1>Rubysapien (TZ-1002)</h1>
747
+ # <p>Geek's Best Friend! Responds to Ruby commands...</p>
748
+ # <ul>
749
+ # <li><b>Listens for verbal commands in the Ruby language!</b></li>
750
+ # <li><b>Ignores Perl, Java, and all C variants.</b></li>
751
+ # <li><b>Karate-Chop Action!!!</b></li>
752
+ # <li><b>Matz signature on left leg.</b></li>
753
+ # <li><b>Gem studded eyes... Rubies, of course!</b></li>
754
+ # </ul>
755
+ # <p>
756
+ # Call for a price, today!
757
+ # </p>
758
+ # </body>
759
+ # </html>
760
+ # ```
761
+ #
762
+ #
763
+ # ## Other Template Processors
764
+ #
765
+ # Various Ruby projects have their own template processors.
766
+ # The Ruby Processing System [RDoc][rdoc], for example, has one that can be used elsewhere.
767
+ #
768
+ # Other popular template processors may be found in the [Template Engines][template engines] page
769
+ # of the Ruby Toolbox.
770
+ #
771
+ # [%q literals]: https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-25q-3A+Non-Interpolable+String+Literals
772
+ # [augmented binding]: rdoc-ref:ERB@Augmented+Binding
773
+ # [binding object]: https://docs.ruby-lang.org/en/master/Binding.html
774
+ # [comment tags]: rdoc-ref:ERB@Comment+Tags
775
+ # [default binding]: rdoc-ref:ERB@Default+Binding
776
+ # [encoding]: https://docs.ruby-lang.org/en/master/Encoding.html
777
+ # [execution tags]: rdoc-ref:ERB@Execution+Tags
778
+ # [expression tags]: rdoc-ref:ERB@Expression+Tags
779
+ # [kernel#binding]: https://docs.ruby-lang.org/en/master/Kernel.html#method-i-binding
780
+ # [local binding]: rdoc-ref:ERB@Local+Binding
781
+ # [magic comments]: https://docs.ruby-lang.org/en/master/syntax/comments_rdoc.html#label-Magic+Comments
782
+ # [rdoc]: https://ruby.github.io/rdoc
783
+ # [sprintf]: https://docs.ruby-lang.org/en/master/Kernel.html#method-i-sprintf
784
+ # [template engines]: https://www.ruby-toolbox.com/categories/template_engines
785
+ # [template processor]: https://en.wikipedia.org/wiki/Template_processor
786
+ #
787
+ # pkg:gem/erb#lib/erb/version.rb:2
788
+ class ERB
789
+ # :markup: markdown
790
+ #
791
+ # :call-seq:
792
+ # ERB.new(template, trim_mode: nil, eoutvar: '_erbout')
793
+ #
794
+ # Returns a new \ERB object containing the given string `template`.
795
+ #
796
+ # For details about `template`, its embedded tags, and generated results, see ERB.
797
+ #
798
+ # **Keyword Argument `trim_mode`**
799
+ #
800
+ # You can use keyword argument `trim_mode: '%'`
801
+ # to enable the [shorthand format][shorthand format] for execution tags.
802
+ #
803
+ # This value allows [blank line control][blank line control]:
804
+ #
805
+ # - `'-'`: Omit each blank line ending with `'%>'`.
806
+ #
807
+ # Other values allow [newline control][newline control]:
808
+ #
809
+ # - `'>'`: Omit newline for each line ending with `'%>'`.
810
+ # - `'<>'`: Omit newline for each line starting with `'<%'` and ending with `'%>'`.
811
+ #
812
+ # You can also [combine trim modes][combine trim modes].
813
+ #
814
+ # **Keyword Argument `eoutvar`**
815
+ #
816
+ # The string value of keyword argument `eoutvar` specifies the name of the variable
817
+ # that method #result uses to construct its result string;
818
+ # see #src.
819
+ #
820
+ # This is useful when you need to run multiple \ERB templates through the same binding
821
+ # and/or when you want to control where output ends up.
822
+ #
823
+ # It's good practice to choose a variable name that begins with an underscore: `'_'`.
824
+ #
825
+ # [blank line control]: rdoc-ref:ERB@Suppressing+Unwanted+Blank+Lines
826
+ # [combine trim modes]: rdoc-ref:ERB@Combining+Trim+Modes
827
+ # [newline control]: rdoc-ref:ERB@Suppressing+Unwanted+Newlines
828
+ # [shorthand format]: rdoc-ref:ERB@Shorthand+Format+for+Execution+Tags
829
+ #
830
+ # pkg:gem/erb#lib/erb.rb:872
831
+ def initialize(str, trim_mode: T.unsafe(nil), eoutvar: T.unsafe(nil)); end
832
+
833
+ # :markup: markdown
834
+ #
835
+ # :call-seq:
836
+ # def_class(super_class = Object, method_name = 'result') -> new_class
837
+ #
838
+ # Returns a new nameless class whose superclass is `super_class`,
839
+ # and which has instance method `method_name`.
840
+ #
841
+ # Create a template from HTML that has embedded expression tags that use `@arg1` and `@arg2`:
842
+ #
843
+ # ```
844
+ # html = <<TEMPLATE
845
+ # <html>
846
+ # <body>
847
+ # <p><%= @arg1 %></p>
848
+ # <p><%= @arg2 %></p>
849
+ # </body>
850
+ # </html>
851
+ # TEMPLATE
852
+ # template = ERB.new(html)
853
+ # ```
854
+ #
855
+ # Create a base class that has `@arg1` and `@arg2`:
856
+ #
857
+ # ```
858
+ # class MyBaseClass
859
+ # def initialize(arg1, arg2)
860
+ # @arg1 = arg1
861
+ # @arg2 = arg2
862
+ # end
863
+ # end
864
+ # ```
865
+ #
866
+ # Use method #def_class to create a subclass that has method `:render`:
867
+ #
868
+ # ```
869
+ # MySubClass = template.def_class(MyBaseClass, :render)
870
+ # ```
871
+ #
872
+ # Generate the result:
873
+ #
874
+ # ```
875
+ # puts MySubClass.new('foo', 123).render
876
+ # ```
877
+ #
878
+ # ```html
879
+ # <html>
880
+ # <body>
881
+ # <p>foo</p>
882
+ # <p>123</p>
883
+ # </body>
884
+ # </html>
885
+ # ```
886
+ #
887
+ # pkg:gem/erb#lib/erb.rb:1238
888
+ def def_class(superklass = T.unsafe(nil), methodname = T.unsafe(nil)); end
889
+
890
+ # :markup: markdown
891
+ #
892
+ # :call-seq:
893
+ # def_method(module, method_signature, filename = '(ERB)') -> method_name
894
+ #
895
+ # Creates and returns a new instance method in the given module `module`;
896
+ # returns the method name as a symbol.
897
+ #
898
+ # The method is created from the given `method_signature`,
899
+ # which consists of the method name and its argument names (if any).
900
+ #
901
+ # The `filename` sets the value of #filename;
902
+ # see [Error Reporting][error reporting].
903
+ #
904
+ # [error reporting]: rdoc-ref:ERB@Error+Reporting
905
+ #
906
+ # ```
907
+ # template = '<%= arg1 %> <%= arg2 %>'
908
+ # erb = ERB.new(template)
909
+ # MyModule = Module.new
910
+ # erb.def_method(MyModule, 'render(arg1, arg2)') # => :render
911
+ # class MyClass; include MyModule; end
912
+ # MyClass.new.render('foo', 123)
913
+ # # => "foo 123"
914
+ # ```
915
+ #
916
+ # pkg:gem/erb#lib/erb.rb:1150
917
+ def def_method(mod, methodname, fname = T.unsafe(nil)); end
918
+
919
+ # :markup: markdown
920
+ #
921
+ # :call-seq:
922
+ # def_module(method_name = 'erb') -> new_module
923
+ #
924
+ # Returns a new nameless module that has instance method `method_name`.
925
+ #
926
+ # ```
927
+ # template = '<%= arg1 %> <%= arg2 %>'
928
+ # erb = ERB.new(template)
929
+ # MyModule = erb.def_module('render(arg1, arg2)')
930
+ # class MyClass
931
+ # include MyModule
932
+ # end
933
+ # MyClass.new.render('foo', 123)
934
+ # # => "foo 123"
935
+ # ```
936
+ #
937
+ # pkg:gem/erb#lib/erb.rb:1178
938
+ def def_module(methodname = T.unsafe(nil)); end
939
+
940
+ # :markup: markdown
941
+ #
942
+ # Returns the encoding of `self`;
943
+ # see [Encodings][encodings]:
944
+ #
945
+ # [encodings]: rdoc-ref:ERB@Encodings
946
+ #
947
+ # pkg:gem/erb#lib/erb.rb:956
948
+ def encoding; end
949
+
950
+ # :markup: markdown
951
+ #
952
+ # Sets or returns the file name to be used in reporting errors;
953
+ # see [Error Reporting][error reporting].
954
+ #
955
+ # [error reporting]: rdoc-ref:ERB@Error+Reporting
956
+ #
957
+ # pkg:gem/erb#lib/erb.rb:964
958
+ def filename; end
959
+
960
+ # :markup: markdown
961
+ #
962
+ # Sets or returns the file name to be used in reporting errors;
963
+ # see [Error Reporting][error reporting].
964
+ #
965
+ # [error reporting]: rdoc-ref:ERB@Error+Reporting
966
+ #
967
+ # pkg:gem/erb#lib/erb.rb:964
968
+ def filename=(_arg0); end
969
+
970
+ # :markup: markdown
971
+ #
972
+ # Sets or returns the line number to be used in reporting errors;
973
+ # see [Error Reporting][error reporting].
974
+ #
975
+ # [error reporting]: rdoc-ref:ERB@Error+Reporting
976
+ #
977
+ # pkg:gem/erb#lib/erb.rb:972
978
+ def lineno; end
979
+
980
+ # :markup: markdown
981
+ #
982
+ # Sets or returns the line number to be used in reporting errors;
983
+ # see [Error Reporting][error reporting].
984
+ #
985
+ # [error reporting]: rdoc-ref:ERB@Error+Reporting
986
+ #
987
+ # pkg:gem/erb#lib/erb.rb:972
988
+ def lineno=(_arg0); end
989
+
990
+ # :markup: markdown
991
+ #
992
+ # :call-seq:
993
+ # location = [filename, lineno] => [filename, lineno]
994
+ # location = filename -> filename
995
+ #
996
+ # Sets the values of #filename and, if given, #lineno;
997
+ # see [Error Reporting][error reporting].
998
+ #
999
+ # [error reporting]: rdoc-ref:ERB@Error+Reporting
1000
+ #
1001
+ # pkg:gem/erb#lib/erb.rb:984
1002
+ def location=(_arg0); end
1003
+
1004
+ # :markup: markdown
1005
+ #
1006
+ # :call-seq:
1007
+ # make_compiler -> erb_compiler
1008
+ #
1009
+ # Returns a new ERB::Compiler with the given `trim_mode`;
1010
+ # for `trim_mode` values, see ERB.new:
1011
+ #
1012
+ # ```
1013
+ # ERB.new('').make_compiler(nil)
1014
+ # # => #<ERB::Compiler:0x000001cff9467678 @insert_cmd="print", @percent=false, @post_cmd=[], @pre_cmd=[], @put_cmd="print", @trim_mode=nil>
1015
+ # ```
1016
+ #
1017
+ # pkg:gem/erb#lib/erb.rb:895
1018
+ def make_compiler(trim_mode); end
1019
+
1020
+ # :markup: markdown
1021
+ #
1022
+ # :call-seq:
1023
+ # result(binding = new_toplevel) -> new_string
1024
+ #
1025
+ # Returns the string result formed by processing \ERB tags found in the stored template in `self`.
1026
+ #
1027
+ # With no argument given, uses the default binding;
1028
+ # see [Default Binding][default binding].
1029
+ #
1030
+ # With argument `binding` given, uses the local binding;
1031
+ # see [Local Binding][local binding].
1032
+ #
1033
+ # See also #result_with_hash.
1034
+ #
1035
+ # [default binding]: rdoc-ref:ERB@Default+Binding
1036
+ # [local binding]: rdoc-ref:ERB@Local+Binding
1037
+ #
1038
+ # pkg:gem/erb#lib/erb.rb:1064
1039
+ def result(b = T.unsafe(nil)); end
1040
+
1041
+ # :markup: markdown
1042
+ #
1043
+ # :call-seq:
1044
+ # result_with_hash(hash) -> new_string
1045
+ #
1046
+ # Returns the string result formed by processing \ERB tags found in the stored string in `self`;
1047
+ # see [Augmented Binding][augmented binding].
1048
+ #
1049
+ # See also #result.
1050
+ #
1051
+ # [augmented binding]: rdoc-ref:ERB@Augmented+Binding
1052
+ #
1053
+ # pkg:gem/erb#lib/erb.rb:1083
1054
+ def result_with_hash(hash); end
1055
+
1056
+ # :markup: markdown
1057
+ #
1058
+ # :call-seq:
1059
+ # run(binding = new_toplevel) -> nil
1060
+ #
1061
+ # Like #result, but prints the result string (instead of returning it);
1062
+ # returns `nil`.
1063
+ #
1064
+ # pkg:gem/erb#lib/erb.rb:1042
1065
+ def run(b = T.unsafe(nil)); end
1066
+
1067
+ # :markup: markdown
1068
+ #
1069
+ # :call-seq:
1070
+ # set_eoutvar(compiler, eoutvar = '_erbout') -> [eoutvar]
1071
+ #
1072
+ # Sets the `eoutvar` value in the ERB::Compiler object `compiler`;
1073
+ # returns a 1-element array containing the value of `eoutvar`:
1074
+ #
1075
+ # ```
1076
+ # template = ERB.new('')
1077
+ # compiler = template.make_compiler(nil)
1078
+ # pp compiler
1079
+ # ```
1080
+ #
1081
+ # ```
1082
+ # #<ERB::Compiler:0x000001cff8a9aa00
1083
+ # @insert_cmd="print",
1084
+ # @percent=false,
1085
+ # @post_cmd=[],
1086
+ # @pre_cmd=[],
1087
+ # @put_cmd="print",
1088
+ # @trim_mode=nil>
1089
+ # ```
1090
+ #
1091
+ # ```
1092
+ # template.set_eoutvar(compiler, '_foo') # => ["_foo"]
1093
+ # pp compiler
1094
+ # ```
1095
+ #
1096
+ # ```
1097
+ # #<ERB::Compiler:0x000001cff8a9aa00
1098
+ # @insert_cmd="_foo.<<",
1099
+ # @percent=false,
1100
+ # @post_cmd=["_foo"],
1101
+ # @pre_cmd=["_foo = +''"],
1102
+ # @put_cmd="_foo.<<",
1103
+ # @trim_mode=nil>
1104
+ # ```
1105
+ #
1106
+ # pkg:gem/erb#lib/erb.rb:1028
1107
+ def set_eoutvar(compiler, eoutvar = T.unsafe(nil)); end
1108
+
1109
+ # :markup: markdown
1110
+ #
1111
+ # Returns the Ruby code that, when executed, generates the result;
1112
+ # the code is executed by method #result,
1113
+ # and by its wrapper methods #result_with_hash and #run:
1114
+ #
1115
+ # ```
1116
+ # template = 'The time is <%= Time.now %>.'
1117
+ # erb = ERB.new(template)
1118
+ # erb.src
1119
+ # # => "#coding:UTF-8\n_erbout = +''; _erbout.<< \"The time is \".freeze; _erbout.<<(( Time.now ).to_s); _erbout.<< \".\".freeze; _erbout"
1120
+ # erb.result
1121
+ # # => "The time is 2025-09-18 15:58:08 -0500."
1122
+ # ```
1123
+ #
1124
+ # In a more readable format:
1125
+ #
1126
+ # ```
1127
+ # puts erb.src.split('; ')
1128
+ # ```
1129
+ #
1130
+ # ```
1131
+ # #coding:UTF-8
1132
+ # _erbout = +''
1133
+ # _erbout.<< "The time is ".freeze
1134
+ # _erbout.<<(( Time.now ).to_s)
1135
+ # _erbout.<< ".".freeze
1136
+ # _erbout
1137
+ # ```
1138
+ #
1139
+ # Variable `_erbout` is used to store the intermediate results in the code;
1140
+ # the name `_erbout` is the default in ERB.new,
1141
+ # and can be changed via keyword argument `eoutvar`:
1142
+ #
1143
+ # ```
1144
+ # erb = ERB.new(template, eoutvar: '_foo')
1145
+ # puts erb.src.split('; ')
1146
+ # ```
1147
+ #
1148
+ # ```
1149
+ # #coding:UTF-8
1150
+ # _foo = +''
1151
+ # _foo.<< "The time is ".freeze
1152
+ # _foo.<<(( Time.now ).to_s)
1153
+ # _foo.<< ".".freeze
1154
+ # _foo
1155
+ # ```
1156
+ #
1157
+ # pkg:gem/erb#lib/erb.rb:947
1158
+ def src; end
1159
+
1160
+ private
1161
+
1162
+ # pkg:gem/erb#lib/erb.rb:1119
1163
+ def initialized_by_new?; end
1164
+
1165
+ # :markup: markdown
1166
+ #
1167
+ # :call-seq:
1168
+ # new_toplevel(symbols) -> new_binding
1169
+ #
1170
+ # Returns a new binding based on `TOPLEVEL_BINDING`;
1171
+ # used to create a default binding for a call to #result.
1172
+ #
1173
+ # See [Default Binding][default binding].
1174
+ #
1175
+ # Argument `symbols` is an array of symbols;
1176
+ # each symbol `symbol` is defined as a new variable to hide and
1177
+ # prevent it from overwriting a variable of the same name already
1178
+ # defined within the binding.
1179
+ #
1180
+ # [default binding]: rdoc-ref:ERB@Default+Binding
1181
+ #
1182
+ # pkg:gem/erb#lib/erb.rb:1107
1183
+ def new_toplevel(vars = T.unsafe(nil)); end
1184
+
1185
+ class << self
1186
+ # :markup: markdown
1187
+ #
1188
+ # :call-seq:
1189
+ # self.version -> string
1190
+ #
1191
+ # Returns the string \ERB version.
1192
+ #
1193
+ # pkg:gem/erb#lib/erb.rb:827
1194
+ def version; end
1195
+ end
1196
+ end
1197
+
1198
+ # --
1199
+ # ERB::Compiler
1200
+ #
1201
+ # Compiles ERB templates into Ruby code; the compiled code produces the
1202
+ # template result when evaluated. ERB::Compiler provides hooks to define how
1203
+ # generated output is handled.
1204
+ #
1205
+ # Internally ERB does something like this to generate the code returned by
1206
+ # ERB#src:
1207
+ #
1208
+ # compiler = ERB::Compiler.new('<>')
1209
+ # compiler.pre_cmd = ["_erbout=+''"]
1210
+ # compiler.put_cmd = "_erbout.<<"
1211
+ # compiler.insert_cmd = "_erbout.<<"
1212
+ # compiler.post_cmd = ["_erbout"]
1213
+ #
1214
+ # code, enc = compiler.compile("Got <%= obj %>!\n")
1215
+ # puts code
1216
+ #
1217
+ # <i>Generates</i>:
1218
+ #
1219
+ # #coding:UTF-8
1220
+ # _erbout=+''; _erbout.<< "Got ".freeze; _erbout.<<(( obj ).to_s); _erbout.<< "!\n".freeze; _erbout
1221
+ #
1222
+ # By default the output is sent to the print method. For example:
1223
+ #
1224
+ # compiler = ERB::Compiler.new('<>')
1225
+ # code, enc = compiler.compile("Got <%= obj %>!\n")
1226
+ # puts code
1227
+ #
1228
+ # <i>Generates</i>:
1229
+ #
1230
+ # #coding:UTF-8
1231
+ # print "Got ".freeze; print(( obj ).to_s); print "!\n".freeze
1232
+ #
1233
+ # == Evaluation
1234
+ #
1235
+ # The compiled code can be used in any context where the names in the code
1236
+ # correctly resolve. Using the last example, each of these print 'Got It!'
1237
+ #
1238
+ # Evaluate using a variable:
1239
+ #
1240
+ # obj = 'It'
1241
+ # eval code
1242
+ #
1243
+ # Evaluate using an input:
1244
+ #
1245
+ # mod = Module.new
1246
+ # mod.module_eval %{
1247
+ # def get(obj)
1248
+ # #{code}
1249
+ # end
1250
+ # }
1251
+ # extend mod
1252
+ # get('It')
1253
+ #
1254
+ # Evaluate using an accessor:
1255
+ #
1256
+ # klass = Class.new Object
1257
+ # klass.class_eval %{
1258
+ # attr_accessor :obj
1259
+ # def initialize(obj)
1260
+ # @obj = obj
1261
+ # end
1262
+ # def get_it
1263
+ # #{code}
1264
+ # end
1265
+ # }
1266
+ # klass.new('It').get_it
1267
+ #
1268
+ # Good! See also ERB#def_method, ERB#def_module, and ERB#def_class.
1269
+ #
1270
+ # pkg:gem/erb#lib/erb/compiler.rb:73
1271
+ class ERB::Compiler
1272
+ # Construct a new compiler using the trim_mode. See ERB::new for available
1273
+ # trim modes.
1274
+ #
1275
+ # pkg:gem/erb#lib/erb/compiler.rb:433
1276
+ def initialize(trim_mode); end
1277
+
1278
+ # pkg:gem/erb#lib/erb/compiler.rb:315
1279
+ def add_insert_cmd(out, content); end
1280
+
1281
+ # pkg:gem/erb#lib/erb/compiler.rb:311
1282
+ def add_put_cmd(out, content); end
1283
+
1284
+ # Compiles an ERB template into Ruby code. Returns an array of the code
1285
+ # and encoding like ["code", Encoding].
1286
+ #
1287
+ # pkg:gem/erb#lib/erb/compiler.rb:321
1288
+ def compile(s); end
1289
+
1290
+ # pkg:gem/erb#lib/erb/compiler.rb:381
1291
+ def compile_content(stag, out); end
1292
+
1293
+ # pkg:gem/erb#lib/erb/compiler.rb:368
1294
+ def compile_etag(etag, out, scanner); end
1295
+
1296
+ # pkg:gem/erb#lib/erb/compiler.rb:344
1297
+ def compile_stag(stag, out, scanner); end
1298
+
1299
+ # The command to handle text that is inserted prior to a newline
1300
+ #
1301
+ # pkg:gem/erb#lib/erb/compiler.rb:446
1302
+ def insert_cmd; end
1303
+
1304
+ # The command to handle text that is inserted prior to a newline
1305
+ #
1306
+ # pkg:gem/erb#lib/erb/compiler.rb:446
1307
+ def insert_cmd=(_arg0); end
1308
+
1309
+ # pkg:gem/erb#lib/erb/compiler.rb:427
1310
+ def make_scanner(src); end
1311
+
1312
+ # pkg:gem/erb#lib/erb/compiler.rb:440
1313
+ def percent; end
1314
+
1315
+ # An array of commands appended to compiled code
1316
+ #
1317
+ # pkg:gem/erb#lib/erb/compiler.rb:452
1318
+ def post_cmd; end
1319
+
1320
+ # An array of commands appended to compiled code
1321
+ #
1322
+ # pkg:gem/erb#lib/erb/compiler.rb:452
1323
+ def post_cmd=(_arg0); end
1324
+
1325
+ # An array of commands prepended to compiled code
1326
+ #
1327
+ # pkg:gem/erb#lib/erb/compiler.rb:449
1328
+ def pre_cmd; end
1329
+
1330
+ # An array of commands prepended to compiled code
1331
+ #
1332
+ # pkg:gem/erb#lib/erb/compiler.rb:449
1333
+ def pre_cmd=(_arg0); end
1334
+
1335
+ # pkg:gem/erb#lib/erb/compiler.rb:398
1336
+ def prepare_trim_mode(mode); end
1337
+
1338
+ # The command to handle text that ends with a newline
1339
+ #
1340
+ # pkg:gem/erb#lib/erb/compiler.rb:443
1341
+ def put_cmd; end
1342
+
1343
+ # The command to handle text that ends with a newline
1344
+ #
1345
+ # pkg:gem/erb#lib/erb/compiler.rb:443
1346
+ def put_cmd=(_arg0); end
1347
+
1348
+ # pkg:gem/erb#lib/erb/compiler.rb:440
1349
+ def trim_mode; end
1350
+
1351
+ private
1352
+
1353
+ # A buffered text in #compile
1354
+ #
1355
+ # pkg:gem/erb#lib/erb/compiler.rb:457
1356
+ def content; end
1357
+
1358
+ # A buffered text in #compile
1359
+ #
1360
+ # pkg:gem/erb#lib/erb/compiler.rb:457
1361
+ def content=(_arg0); end
1362
+
1363
+ # pkg:gem/erb#lib/erb/compiler.rb:459
1364
+ def detect_magic_comment(s, enc = T.unsafe(nil)); end
1365
+
1366
+ # pkg:gem/erb#lib/erb/compiler.rb:484
1367
+ def warn_invalid_trim_mode(mode, uplevel:); end
1368
+ end
1369
+
1370
+ # pkg:gem/erb#lib/erb/compiler.rb:278
1371
+ class ERB::Compiler::Buffer
1372
+ # pkg:gem/erb#lib/erb/compiler.rb:279
1373
+ def initialize(compiler, enc = T.unsafe(nil), frozen = T.unsafe(nil)); end
1374
+
1375
+ # pkg:gem/erb#lib/erb/compiler.rb:301
1376
+ def close; end
1377
+
1378
+ # pkg:gem/erb#lib/erb/compiler.rb:295
1379
+ def cr; end
1380
+
1381
+ # pkg:gem/erb#lib/erb/compiler.rb:291
1382
+ def push(cmd); end
1383
+
1384
+ # pkg:gem/erb#lib/erb/compiler.rb:289
1385
+ def script; end
1386
+ end
1387
+
1388
+ # pkg:gem/erb#lib/erb/compiler.rb:254
1389
+ class ERB::Compiler::ExplicitScanner < ::ERB::Compiler::Scanner
1390
+ # pkg:gem/erb#lib/erb/compiler.rb:255
1391
+ def scan; end
1392
+ end
1393
+
1394
+ # pkg:gem/erb#lib/erb/compiler.rb:74
1395
+ class ERB::Compiler::PercentLine
1396
+ # pkg:gem/erb#lib/erb/compiler.rb:75
1397
+ def initialize(str); end
1398
+
1399
+ # pkg:gem/erb#lib/erb/compiler.rb:79
1400
+ def to_s; end
1401
+
1402
+ # pkg:gem/erb#lib/erb/compiler.rb:78
1403
+ def value; end
1404
+ end
1405
+
1406
+ # pkg:gem/erb#lib/erb/compiler.rb:82
1407
+ class ERB::Compiler::Scanner
1408
+ # pkg:gem/erb#lib/erb/compiler.rb:108
1409
+ def initialize(src, trim_mode, percent); end
1410
+
1411
+ # pkg:gem/erb#lib/erb/compiler.rb:115
1412
+ def etags; end
1413
+
1414
+ # pkg:gem/erb#lib/erb/compiler.rb:117
1415
+ def scan; end
1416
+
1417
+ # pkg:gem/erb#lib/erb/compiler.rb:114
1418
+ def stag; end
1419
+
1420
+ # pkg:gem/erb#lib/erb/compiler.rb:114
1421
+ def stag=(_arg0); end
1422
+
1423
+ # pkg:gem/erb#lib/erb/compiler.rb:115
1424
+ def stags; end
1425
+
1426
+ class << self
1427
+ # pkg:gem/erb#lib/erb/compiler.rb:97
1428
+ def default_scanner=(klass); end
1429
+
1430
+ # pkg:gem/erb#lib/erb/compiler.rb:101
1431
+ def make_scanner(src, trim_mode, percent); end
1432
+
1433
+ # pkg:gem/erb#lib/erb/compiler.rb:94
1434
+ def regist_scanner(klass, trim_mode, percent); end
1435
+
1436
+ # pkg:gem/erb#lib/erb/compiler.rb:86
1437
+ def register_scanner(klass, trim_mode, percent); end
1438
+ end
1439
+ end
1440
+
1441
+ # pkg:gem/erb#lib/erb/compiler.rb:107
1442
+ ERB::Compiler::Scanner::DEFAULT_ETAGS = T.let(T.unsafe(nil), Array)
1443
+
1444
+ # pkg:gem/erb#lib/erb/compiler.rb:106
1445
+ ERB::Compiler::Scanner::DEFAULT_STAGS = T.let(T.unsafe(nil), Array)
1446
+
1447
+ # pkg:gem/erb#lib/erb/compiler.rb:240
1448
+ class ERB::Compiler::SimpleScanner < ::ERB::Compiler::Scanner
1449
+ # pkg:gem/erb#lib/erb/compiler.rb:241
1450
+ def scan; end
1451
+ end
1452
+
1453
+ # pkg:gem/erb#lib/erb/compiler.rb:120
1454
+ class ERB::Compiler::TrimScanner < ::ERB::Compiler::Scanner
1455
+ # pkg:gem/erb#lib/erb/compiler.rb:121
1456
+ def initialize(src, trim_mode, percent); end
1457
+
1458
+ # pkg:gem/erb#lib/erb/compiler.rb:210
1459
+ def explicit_trim_line(line); end
1460
+
1461
+ # pkg:gem/erb#lib/erb/compiler.rb:229
1462
+ def is_erb_stag?(s); end
1463
+
1464
+ # pkg:gem/erb#lib/erb/compiler.rb:152
1465
+ def percent_line(line, &block); end
1466
+
1467
+ # pkg:gem/erb#lib/erb/compiler.rb:140
1468
+ def scan(&block); end
1469
+
1470
+ # pkg:gem/erb#lib/erb/compiler.rb:165
1471
+ def scan_line(line); end
1472
+
1473
+ # pkg:gem/erb#lib/erb/compiler.rb:174
1474
+ def trim_line1(line); end
1475
+
1476
+ # pkg:gem/erb#lib/erb/compiler.rb:188
1477
+ def trim_line2(line); end
1478
+ end
1479
+
1480
+ # :stopdoc:
1481
+ #
1482
+ # pkg:gem/erb#lib/erb/compiler.rb:476
1483
+ ERB::Compiler::WARNING_UPLEVEL = T.let(T.unsafe(nil), Integer)
1484
+
1485
+ # ERB::DefMethod
1486
+ #
1487
+ # Utility module to define eRuby script as instance method.
1488
+ #
1489
+ # === Example
1490
+ #
1491
+ # example.rhtml:
1492
+ # <% for item in @items %>
1493
+ # <b><%= item %></b>
1494
+ # <% end %>
1495
+ #
1496
+ # example.rb:
1497
+ # require 'erb'
1498
+ # class MyClass
1499
+ # extend ERB::DefMethod
1500
+ # def_erb_method('render()', 'example.rhtml')
1501
+ # def initialize(items)
1502
+ # @items = items
1503
+ # end
1504
+ # end
1505
+ # print MyClass.new([10,20,30]).render()
1506
+ #
1507
+ # result:
1508
+ #
1509
+ # <b>10</b>
1510
+ #
1511
+ # <b>20</b>
1512
+ #
1513
+ # <b>30</b>
1514
+ #
1515
+ # pkg:gem/erb#lib/erb/def_method.rb:33
1516
+ module ERB::DefMethod
1517
+ private
1518
+
1519
+ # define _methodname_ as instance method of current module, using ERB
1520
+ # object or eRuby file
1521
+ #
1522
+ # pkg:gem/erb#lib/erb/def_method.rb:36
1523
+ def def_erb_method(methodname, erb_or_fname); end
1524
+
1525
+ class << self
1526
+ # define _methodname_ as instance method of current module, using ERB
1527
+ # object or eRuby file
1528
+ #
1529
+ # pkg:gem/erb#lib/erb/def_method.rb:46
1530
+ def def_erb_method(methodname, erb_or_fname); end
1531
+ end
1532
+ end
1533
+
1534
+ # pkg:gem/erb#lib/erb.rb:818
1535
+ ERB::IDENTITY_METHOD = T.let(T.unsafe(nil), UnboundMethod)
1536
+
1537
+ # ERB::Util
1538
+ #
1539
+ # A utility module for conversion routines, often handy in HTML generation.
1540
+ #
1541
+ # pkg:gem/erb#lib/erb/util.rb:33
1542
+ module ERB::Util
1543
+ include ::ERB::Escape
1544
+
1545
+ private
1546
+
1547
+ # pkg:gem/erb#lib/erb/util.rb:48
1548
+ def h(_arg0); end
1549
+
1550
+ # pkg:gem/erb#lib/erb/util.rb:74
1551
+ def u(s); end
1552
+
1553
+ # A utility method for encoding the String _s_ as a URL.
1554
+ #
1555
+ # require "erb"
1556
+ # include ERB::Util
1557
+ #
1558
+ # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
1559
+ #
1560
+ # _Generates_
1561
+ #
1562
+ # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
1563
+ #
1564
+ # cgi.gem <= v0.3.2
1565
+ #
1566
+ # pkg:gem/erb#lib/erb/util.rb:64
1567
+ def url_encode(s); end
1568
+
1569
+ class << self
1570
+ # pkg:gem/erb#lib/erb/util.rb:49
1571
+ def h(_arg0); end
1572
+
1573
+ # pkg:gem/erb#lib/erb/util.rb:47
1574
+ def html_escape(_arg0); end
1575
+
1576
+ # pkg:gem/erb#lib/erb/util.rb:75
1577
+ def u(s); end
1578
+
1579
+ # A utility method for encoding the String _s_ as a URL.
1580
+ #
1581
+ # require "erb"
1582
+ # include ERB::Util
1583
+ #
1584
+ # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
1585
+ #
1586
+ # _Generates_
1587
+ #
1588
+ # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
1589
+ #
1590
+ # cgi.gem <= v0.3.2
1591
+ #
1592
+ # pkg:gem/erb#lib/erb/util.rb:76
1593
+ def url_encode(s); end
1594
+ end
1595
+ end
1596
+
1597
+ # The string \ERB version.
1598
+ #
1599
+ # pkg:gem/erb#lib/erb/version.rb:4
1600
+ ERB::VERSION = T.let(T.unsafe(nil), String)