steep 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/CHANGELOG.md +6 -0
  4. data/Rakefile +0 -13
  5. data/bin/setup +0 -2
  6. data/bin/smoke_runner.rb +0 -1
  7. data/exe/steep +0 -1
  8. data/lib/steep/project/file.rb +1 -1
  9. data/lib/steep/project/hover_content.rb +1 -1
  10. data/lib/steep/server/code_worker.rb +1 -1
  11. data/lib/steep/server/signature_worker.rb +4 -4
  12. data/lib/steep/type_construction.rb +10 -16
  13. data/lib/steep/type_inference/constant_env.rb +2 -10
  14. data/lib/steep/type_inference/context.rb +1 -0
  15. data/lib/steep/version.rb +1 -1
  16. data/steep.gemspec +1 -5
  17. metadata +17 -135
  18. data/exe/rbs +0 -3
  19. data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
  20. data/vendor/ruby-signature/.gitignore +0 -12
  21. data/vendor/ruby-signature/.rubocop.yml +0 -15
  22. data/vendor/ruby-signature/BSDL +0 -22
  23. data/vendor/ruby-signature/COPYING +0 -56
  24. data/vendor/ruby-signature/Gemfile +0 -6
  25. data/vendor/ruby-signature/README.md +0 -93
  26. data/vendor/ruby-signature/Rakefile +0 -142
  27. data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
  28. data/vendor/ruby-signature/bin/console +0 -14
  29. data/vendor/ruby-signature/bin/query-rdoc +0 -103
  30. data/vendor/ruby-signature/bin/setup +0 -10
  31. data/vendor/ruby-signature/bin/sort +0 -89
  32. data/vendor/ruby-signature/bin/test_runner.rb +0 -16
  33. data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
  34. data/vendor/ruby-signature/docs/sigs.md +0 -148
  35. data/vendor/ruby-signature/docs/stdlib.md +0 -152
  36. data/vendor/ruby-signature/docs/syntax.md +0 -528
  37. data/vendor/ruby-signature/exe/rbs +0 -7
  38. data/vendor/ruby-signature/lib/rbs.rb +0 -64
  39. data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
  40. data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
  41. data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
  42. data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
  43. data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
  44. data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
  45. data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
  46. data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
  47. data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
  48. data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
  49. data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
  50. data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
  51. data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
  52. data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
  53. data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
  54. data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
  55. data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
  56. data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
  57. data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
  58. data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
  59. data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
  60. data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
  61. data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
  62. data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
  63. data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
  64. data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
  65. data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
  66. data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
  67. data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
  68. data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
  69. data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
  70. data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
  71. data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
  72. data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
  73. data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
  74. data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
  75. data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
  76. data/vendor/ruby-signature/rbs.gemspec +0 -46
  77. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
  78. data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
  79. data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
  80. data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
  81. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
  82. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
  83. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -45
  84. data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
  85. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
  86. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
  87. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
  88. data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
  89. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
  90. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
  91. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
  92. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
  93. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
  94. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
  95. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
  96. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
  97. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
  98. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
  99. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
  100. data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
  101. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
  102. data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
  103. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
  104. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
  105. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
  106. data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
  107. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
  108. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
  109. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
  110. data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
  111. data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
  112. data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
  113. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
  114. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
  115. data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
  116. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
  117. data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
  118. data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
  119. data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
  120. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
  121. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
  122. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
  123. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
  124. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
  125. data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
  126. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
  127. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
  128. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
  129. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
  130. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
  131. data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
  132. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
  133. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
  134. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
  135. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
  136. data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
  137. data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
  138. data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
  139. data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
  140. data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
  141. data/vendor/ruby-signature/stdlib/json/json.rbs +0 -335
  142. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
  143. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
  144. data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
  145. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
  146. data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
  147. data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,392 +0,0 @@
1
- # # ERB -- Ruby Templating
2
- #
3
- # ## Introduction
4
- #
5
- # ERB provides an easy to use but powerful templating system for Ruby. Using
6
- # ERB, actual Ruby code can be added to any plain text document for the purposes
7
- # of generating document information details and/or flow control.
8
- #
9
- # A very simple example is this:
10
- #
11
- # require 'erb'
12
- #
13
- # x = 42
14
- # template = ERB.new <<-EOF
15
- # The value of x is: <%= x %>
16
- # EOF
17
- # puts template.result(binding)
18
- #
19
- # *Prints:* The value of x is: 42
20
- #
21
- # More complex examples are given below.
22
- #
23
- # ## Recognized Tags
24
- #
25
- # ERB recognizes certain tags in the provided template and converts them based
26
- # on the rules below:
27
- #
28
- # <% Ruby code -- inline with output %>
29
- # <%= Ruby expression -- replace with result %>
30
- # <%# comment -- ignored -- useful in testing %>
31
- # % a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
32
- # %% replaced with % if first thing on a line and % processing is used
33
- # <%% or %%> -- replace with <% or %> respectively
34
- #
35
- # All other text is passed through ERB filtering unchanged.
36
- #
37
- # ## Options
38
- #
39
- # There are several settings you can change when you use ERB:
40
- # * the nature of the tags that are recognized;
41
- # * the value of `$SAFE` under which the template is run;
42
- # * the binding used to resolve local variables in the template.
43
- #
44
- #
45
- # See the ERB.new and ERB#result methods for more detail.
46
- #
47
- # ## Character encodings
48
- #
49
- # ERB (or Ruby code generated by ERB) returns a string in the same character
50
- # encoding as the input string. When the input string has a magic comment,
51
- # however, it returns a string in the encoding specified by the magic comment.
52
- #
53
- # # -*- coding: utf-8 -*-
54
- # require 'erb'
55
- #
56
- # template = ERB.new <<EOF
57
- # <%#-*- coding: Big5 -*-%>
58
- # \_\_ENCODING\_\_ is <%= \_\_ENCODING\_\_ %>.
59
- # EOF
60
- # puts template.result
61
- #
62
- # *Prints:* _*ENCODING*_ is Big5.
63
- #
64
- # ## Examples
65
- #
66
- # ### Plain Text
67
- #
68
- # ERB is useful for any generic templating situation. Note that in this
69
- # example, we use the convenient "% at start of line" tag, and we quote the
70
- # template literally with `%q{...}` to avoid trouble with the backslash.
71
- #
72
- # require "erb"
73
- #
74
- # # Create template.
75
- # template = %q{
76
- # From: James Edward Gray II <james@grayproductions.net>
77
- # To: <%= to %>
78
- # Subject: Addressing Needs
79
- #
80
- # <%= to[/\w+/] %>:
81
- #
82
- # Just wanted to send a quick note assuring that your needs are being
83
- # addressed.
84
- #
85
- # I want you to know that my team will keep working on the issues,
86
- # especially:
87
- #
88
- # <%# ignore numerous minor requests -- focus on priorities %>
89
- # % priorities.each do |priority|
90
- # * <%= priority %>
91
- # % end
92
- #
93
- # Thanks for your patience.
94
- #
95
- # James Edward Gray II
96
- # }.gsub(/^ /, '')
97
- #
98
- # message = ERB.new(template, trim_mode: "%<>")
99
- #
100
- # # Set up template data.
101
- # to = "Community Spokesman <spokesman@ruby_community.org>"
102
- # priorities = [ "Run Ruby Quiz",
103
- # "Document Modules",
104
- # "Answer Questions on Ruby Talk" ]
105
- #
106
- # # Produce result.
107
- # email = message.result
108
- # puts email
109
- #
110
- # *Generates:*
111
- #
112
- # From: James Edward Gray II <james@grayproductions.net>
113
- # To: Community Spokesman <spokesman@ruby_community.org>
114
- # Subject: Addressing Needs
115
- #
116
- # Community:
117
- #
118
- # Just wanted to send a quick note assuring that your needs are being addressed.
119
- #
120
- # I want you to know that my team will keep working on the issues, especially:
121
- #
122
- # * Run Ruby Quiz
123
- # * Document Modules
124
- # * Answer Questions on Ruby Talk
125
- #
126
- # Thanks for your patience.
127
- #
128
- # James Edward Gray II
129
- #
130
- # ### Ruby in HTML
131
- #
132
- # ERB is often used in `.rhtml` files (HTML with embedded Ruby). Notice the
133
- # need in this example to provide a special binding when the template is run, so
134
- # that the instance variables in the Product object can be resolved.
135
- #
136
- # require "erb"
137
- #
138
- # # Build template data class.
139
- # class Product
140
- # def initialize( code, name, desc, cost )
141
- # @code = code
142
- # @name = name
143
- # @desc = desc
144
- # @cost = cost
145
- #
146
- # @features = [ ]
147
- # end
148
- #
149
- # def add_feature( feature )
150
- # @features << feature
151
- # end
152
- #
153
- # # Support templating of member data.
154
- # def get_binding
155
- # binding
156
- # end
157
- #
158
- # # ...
159
- # end
160
- #
161
- # # Create template.
162
- # template = %{
163
- # <html>
164
- # <head><title>Ruby Toys -- <%= @name %></title></head>
165
- # <body>
166
- #
167
- # <h1><%= @name %> (<%= @code %>)</h1>
168
- # <p><%= @desc %></p>
169
- #
170
- # <ul>
171
- # <% @features.each do |f| %>
172
- # <li><b><%= f %></b></li>
173
- # <% end %>
174
- # </ul>
175
- #
176
- # <p>
177
- # <% if @cost < 10 %>
178
- # <b>Only <%= @cost %>!!!</b>
179
- # <% else %>
180
- # Call for a price, today!
181
- # <% end %>
182
- # </p>
183
- #
184
- # </body>
185
- # </html>
186
- # }.gsub(/^ /, '')
187
- #
188
- # rhtml = ERB.new(template)
189
- #
190
- # # Set up template data.
191
- # toy = Product.new( "TZ-1002",
192
- # "Rubysapien",
193
- # "Geek's Best Friend! Responds to Ruby commands...",
194
- # 999.95 )
195
- # toy.add_feature("Listens for verbal commands in the Ruby language!")
196
- # toy.add_feature("Ignores Perl, Java, and all C variants.")
197
- # toy.add_feature("Karate-Chop Action!!!")
198
- # toy.add_feature("Matz signature on left leg.")
199
- # toy.add_feature("Gem studded eyes... Rubies, of course!")
200
- #
201
- # # Produce result.
202
- # rhtml.run(toy.get_binding)
203
- #
204
- # *Generates (some blank lines removed):*
205
- #
206
- # <html>
207
- # <head><title>Ruby Toys -- Rubysapien</title></head>
208
- # <body>
209
- #
210
- # <h1>Rubysapien (TZ-1002)</h1>
211
- # <p>Geek's Best Friend! Responds to Ruby commands...</p>
212
- #
213
- # <ul>
214
- # <li><b>Listens for verbal commands in the Ruby language!</b></li>
215
- # <li><b>Ignores Perl, Java, and all C variants.</b></li>
216
- # <li><b>Karate-Chop Action!!!</b></li>
217
- # <li><b>Matz signature on left leg.</b></li>
218
- # <li><b>Gem studded eyes... Rubies, of course!</b></li>
219
- # </ul>
220
- #
221
- # <p>
222
- # Call for a price, today!
223
- # </p>
224
- #
225
- # </body>
226
- # </html>
227
- #
228
- # ## Notes
229
- #
230
- # There are a variety of templating solutions available in various Ruby
231
- # projects:
232
- # * ERB's big brother, eRuby, works the same but is written in C for speed;
233
- # * Amrita (smart at producing HTML/XML);
234
- # * cs/Template (written in C for speed);
235
- # * RDoc, distributed with Ruby, uses its own template engine, which can be
236
- # reused elsewhere;
237
- # * and others; search [RubyGems.org](https://rubygems.org/) or [The Ruby
238
- # Toolbox](https://www.ruby-toolbox.com/).
239
- #
240
- #
241
- # Rails, the web application framework, uses ERB to create views.
242
- #
243
- class ERB
244
- # Returns revision information for the erb.rb module.
245
- #
246
- def self.version: () -> String
247
-
248
- # Constructs a new ERB object with the template specified in *str*.
249
- #
250
- # An ERB object works by building a chunk of Ruby code that will output the
251
- # completed template when run. If *safe_level* is set to a non-nil value, ERB
252
- # code will be run in a separate thread with **$SAFE** set to the provided
253
- # level.
254
- #
255
- # If *trim_mode* is passed a String containing one or more of the following
256
- # modifiers, ERB will adjust its code generation as listed:
257
- #
258
- # % enables Ruby code processing for lines beginning with %
259
- # <> omit newline for lines starting with <% and ending in %>
260
- # > omit newline for lines ending in %>
261
- # - omit blank lines ending in -%>
262
- #
263
- # *eoutvar* can be used to set the name of the variable ERB will build up its
264
- # output in. This is useful when you need to run multiple ERB templates through
265
- # the same binding and/or when you want to control where output ends up. Pass
266
- # the name of the variable to be used inside a String.
267
- #
268
- # ### Example
269
- #
270
- # require "erb"
271
- #
272
- # # build data class
273
- # class Listings
274
- # PRODUCT = { :name => "Chicken Fried Steak",
275
- # :desc => "A well messages pattie, breaded and fried.",
276
- # :cost => 9.95 }
277
- #
278
- # attr_reader :product, :price
279
- #
280
- # def initialize( product = "", price = "" )
281
- # @product = product
282
- # @price = price
283
- # end
284
- #
285
- # def build
286
- # b = binding
287
- # # create and run templates, filling member data variables
288
- # ERB.new(<<-'END_PRODUCT'.gsub(/^\s+/, ""), trim_mode: "", eoutvar: "@product").result b
289
- # <%= PRODUCT[:name] %>
290
- # <%= PRODUCT[:desc] %>
291
- # END_PRODUCT
292
- # ERB.new(<<-'END_PRICE'.gsub(/^\s+/, ""), trim_mode: "", eoutvar: "@price").result b
293
- # <%= PRODUCT[:name] %> -- <%= PRODUCT[:cost] %>
294
- # <%= PRODUCT[:desc] %>
295
- # END_PRICE
296
- # end
297
- # end
298
- #
299
- # # setup template data
300
- # listings = Listings.new
301
- # listings.build
302
- #
303
- # puts listings.product + "\n" + listings.price
304
- #
305
- # *Generates*
306
- #
307
- # Chicken Fried Steak
308
- # A well messages pattie, breaded and fried.
309
- #
310
- # Chicken Fried Steak -- 9.95
311
- # A well messages pattie, breaded and fried.
312
- #
313
- def initialize: (String, ?eoutvar: String, ?trim_mode: Integer | String | NilClass) -> untyped
314
-
315
- # The Ruby code generated by ERB
316
- #
317
- def src: () -> String
318
-
319
- # The encoding to eval
320
- #
321
- def encoding: () -> Encoding
322
-
323
- # The optional *filename* argument passed to Kernel#eval when the ERB code is
324
- # run
325
- #
326
- def filename: () -> (String | NilClass)
327
- def filename=: (String | NilClass) -> untyped
328
-
329
- # The optional *lineno* argument passed to Kernel#eval when the ERB code is run
330
- #
331
- def lineno: () -> Integer
332
- def lineno=: (Integer) -> untyped
333
- def location=: (Array[String | Integer]) -> untyped
334
-
335
- # Generate results and print them. (see ERB#result)
336
- #
337
- def run: (?Binding) -> untyped
338
-
339
- # Executes the generated ERB code to produce a completed template, returning the
340
- # results of that code. (See ERB::new for details on how this process can be
341
- # affected by *safe_level*.)
342
- #
343
- # *b* accepts a Binding object which is used to set the context of code
344
- # evaluation.
345
- #
346
- def result: (?Binding) -> String
347
-
348
- # Render a template on a new toplevel binding with local variables specified by
349
- # a Hash object.
350
- #
351
- def result_with_hash: (Hash[untyped, untyped]) -> String
352
-
353
- # Define *methodname* as instance method of *mod* from compiled Ruby source.
354
- #
355
- # example:
356
- # filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml
357
- # erb = ERB.new(File.read(filename))
358
- # erb.def_method(MyClass, 'render(arg1, arg2)', filename)
359
- # print MyClass.new.render('foo', 123)
360
- #
361
- def def_method: (Module, String, ?String) -> untyped
362
-
363
- # Create unnamed module, define *methodname* as instance method of it, and
364
- # return it.
365
- #
366
- # example:
367
- # filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml
368
- # erb = ERB.new(File.read(filename))
369
- # erb.filename = filename
370
- # MyModule = erb.def_module('render(arg1, arg2)')
371
- # class MyClass
372
- # include MyModule
373
- # end
374
- #
375
- def def_module: (?String) -> Module
376
-
377
- # Define unnamed class which has *methodname* as instance method, and return it.
378
- #
379
- # example:
380
- # class MyClass_
381
- # def initialize(arg1, arg2)
382
- # @arg1 = arg1; @arg2 = arg2
383
- # end
384
- # end
385
- # filename = 'example.rhtml' # @arg1 and @arg2 are used in example.rhtml
386
- # erb = ERB.new(File.read(filename))
387
- # erb.filename = filename
388
- # MyClass = erb.def_class(MyClass_, 'render()')
389
- # print MyClass.new('foo', 123).render()
390
- #
391
- def def_class: (?Class, ?String) -> Class
392
- end
@@ -1,40 +0,0 @@
1
- # The `Find` module supports the top-down traversal of a set of file paths.
2
- #
3
- # For example, to total the size of all files under your home directory,
4
- # ignoring anything in a "dot" directory (e.g. $HOME/.ssh):
5
- #
6
- # require 'find'
7
- #
8
- # total_size = 0
9
- #
10
- # Find.find(ENV["HOME"]) do |path|
11
- # if FileTest.directory?(path)
12
- # if File.basename(path).start_with?('.')
13
- # Find.prune # Don't look any further into this directory.
14
- # else
15
- # next
16
- # end
17
- # else
18
- # total_size += FileTest.size(path)
19
- # end
20
- # end
21
- #
22
- module Find
23
- # Calls the associated block with the name of every file and directory listed as
24
- # arguments, then recursively on their subdirectories, and so on.
25
- #
26
- # Returns an enumerator if no block is given.
27
- #
28
- # See the `Find` module documentation for an example.
29
- #
30
- def self?.find: (*String | _ToPath paths, ?ignore_error: bool) -> Enumerator[String, nil]
31
- | (*String | _ToPath paths, ?ignore_error: bool) { (String arg0) -> void } -> nil
32
-
33
- # Skips the current file or directory, restarting the loop with the next entry.
34
- # If the current file is a directory, that directory will not be recursively
35
- # entered. Meaningful only within the block associated with Find::find.
36
- #
37
- # See the `Find` module documentation for an example.
38
- #
39
- def self?.prune: () -> void
40
- end
@@ -1,247 +0,0 @@
1
- # IPAddr provides a set of methods to manipulate an IP address. Both IPv4 and
2
- # IPv6 are supported.
3
- #
4
- # ## Example
5
- #
6
- # require 'ipaddr'
7
- #
8
- # ipaddr1 = IPAddr.new "3ffe:505:2::1"
9
- #
10
- # p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
11
- #
12
- # p ipaddr1.to_s #=> "3ffe:505:2::1"
13
- #
14
- # ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>
15
- #
16
- # p ipaddr2.to_s #=> "3ffe:505:2::"
17
- #
18
- # ipaddr3 = IPAddr.new "192.168.2.0/24"
19
- #
20
- # p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0>
21
- #
22
- class IPAddr
23
- include Comparable
24
-
25
- # Creates a new ipaddr containing the given network byte ordered string form of
26
- # an IP address.
27
- #
28
- def self.new_ntoh: (String addr) -> IPAddr
29
-
30
- # Convert a network byte ordered string form of an IP address into human
31
- # readable form.
32
- #
33
- def self.ntop: (String addr) -> String
34
-
35
- # Creates a new ipaddr object either from a human readable IP address
36
- # representation in string, or from a packed in_addr value followed by an
37
- # address family.
38
- #
39
- # In the former case, the following are the valid formats that will be
40
- # recognized: "address", "address/prefixlen" and "address/mask", where IPv6
41
- # address may be enclosed in square brackets (`[' and `]'). If a prefixlen or a
42
- # mask is specified, it returns a masked IP address. Although the address
43
- # family is determined automatically from a specified string, you can specify
44
- # one explicitly by the optional second argument.
45
- #
46
- # Otherwise an IP address is generated from a packed in_addr value and an
47
- # address family.
48
- #
49
- # The IPAddr class defines many methods and operators, and some of those, such
50
- # as &, |, include? and ==, accept a string, or a packed in_addr value instead
51
- # of an IPAddr object.
52
- #
53
- def initialize: (?String addr, ?untyped family) -> IPAddr
54
-
55
- # Returns a new ipaddr built by bitwise AND.
56
- #
57
- def &: (untyped other) -> IPAddr
58
-
59
- # Returns a new ipaddr built by bitwise left shift.
60
- #
61
- def <<: (Integer num) -> IPAddr
62
-
63
- # Compares the ipaddr with another.
64
- #
65
- def <=>: (untyped other) -> Integer?
66
-
67
- # Returns true if two ipaddrs are equal.
68
- #
69
- def ==: (untyped other) -> bool
70
-
71
- alias === include?
72
-
73
- # Returns a new ipaddr built by bitwise right-shift.
74
- #
75
- def >>: (Integer num) -> IPAddr
76
-
77
- # Checks equality used by Hash.
78
- #
79
- def eql?: (untyped other) -> bool
80
-
81
- # Returns the address family of this IP address.
82
- #
83
- attr_reader family: Integer
84
-
85
- # Returns a hash value used by Hash, Set, and Array classes
86
- #
87
- def hash: () -> Integer
88
-
89
- # Returns a network byte ordered string form of the IP address.
90
- #
91
- def hton: () -> String
92
-
93
- # Returns true if the given ipaddr is in the range.
94
- #
95
- # e.g.:
96
- # require 'ipaddr'
97
- # net1 = IPAddr.new("192.168.2.0/24")
98
- # net2 = IPAddr.new("192.168.2.100")
99
- # net3 = IPAddr.new("192.168.3.0")
100
- # p net1.include?(net2) #=> true
101
- # p net1.include?(net3) #=> false
102
- #
103
- def include?: (untyped other) -> bool
104
-
105
- # Returns a string containing a human-readable representation of the ipaddr.
106
- # ("#<IPAddr: family:address/mask>")
107
- #
108
- def inspect: () -> String
109
-
110
- # Returns a string for DNS reverse lookup compatible with RFC3172.
111
- #
112
- def ip6_arpa: () -> String
113
-
114
- # Returns a string for DNS reverse lookup compatible with RFC1886.
115
- #
116
- def ip6_int: () -> String
117
-
118
- # Returns true if the ipaddr is an IPv4 address.
119
- #
120
- def ipv4?: () -> bool
121
-
122
- # Returns a new ipaddr built by converting the native IPv4 address into an
123
- # IPv4-compatible IPv6 address.
124
- #
125
- def ipv4_compat: () -> IPAddr
126
-
127
- # Returns true if the ipaddr is an IPv4-compatible IPv6 address.
128
- #
129
- def ipv4_compat?: () -> bool
130
-
131
- # Returns a new ipaddr built by converting the native IPv4 address into an
132
- # IPv4-mapped IPv6 address.
133
- #
134
- def ipv4_mapped: () -> IPAddr
135
-
136
- # Returns true if the ipaddr is an IPv4-mapped IPv6 address.
137
- #
138
- def ipv4_mapped?: () -> bool
139
-
140
- # Returns true if the ipaddr is an IPv6 address.
141
- #
142
- def ipv6?: () -> bool
143
-
144
- # Returns true if the ipaddr is a link-local address. IPv4 addresses in
145
- # 169.254.0.0/16 reserved by RFC 3927 and Link-Local IPv6 Unicast Addresses in
146
- # fe80::/10 reserved by RFC 4291 are considered link-local.
147
- #
148
- def link_local?: () -> bool
149
-
150
- # Returns true if the ipaddr is a loopback address.
151
- #
152
- def loopback?: () -> bool
153
-
154
- # Returns a new ipaddr built by masking IP address with the given
155
- # prefixlen/netmask. (e.g. 8, 64, "255.255.255.0", etc.)
156
- #
157
- def mask: (String | Integer prefixlen) -> IPAddr
158
-
159
- # Returns a new ipaddr built by converting the IPv6 address into a native IPv4
160
- # address. If the IP address is not an IPv4-mapped or IPv4-compatible IPv6
161
- # address, returns self.
162
- #
163
- def native: () -> IPAddr
164
-
165
- # Returns the prefix length in bits for the ipaddr.
166
- #
167
- def prefix: () -> Integer
168
-
169
- # Sets the prefix length in bits
170
- #
171
- def prefix=: (Integer prefix) -> self
172
-
173
- # Returns true if the ipaddr is a private address. IPv4 addresses in
174
- # 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 as defined in RFC 1918 and IPv6
175
- # Unique Local Addresses in fc00::/7 as defined in RFC 4193 are considered
176
- # private.
177
- #
178
- def private?: () -> bool
179
-
180
- # Returns a string for DNS reverse lookup. It returns a string in RFC3172 form
181
- # for an IPv6 address.
182
- #
183
- def reverse: () -> String
184
-
185
- # Returns the successor to the ipaddr.
186
- #
187
- def succ: () -> IPAddr
188
-
189
- # Returns the integer representation of the ipaddr.
190
- #
191
- def to_i: () -> Integer
192
-
193
- # Creates a Range object for the network address.
194
- #
195
- def to_range: () -> Range[IPAddr]
196
-
197
- # Returns a string containing the IP address representation.
198
- #
199
- def to_s: () -> String
200
-
201
- # Returns a string containing the IP address representation in canonical form.
202
- #
203
- def to_string: () -> String
204
-
205
- # Returns a new ipaddr built by bitwise OR.
206
- #
207
- def |: (untyped other) -> IPAddr
208
-
209
- # Returns a new ipaddr built by bitwise negation.
210
- #
211
- def ~: () -> IPAddr
212
- end
213
-
214
- # Generic IPAddr related error. Exceptions raised in this class should inherit
215
- # from Error.
216
- #
217
- class IPAddr::Error < ArgumentError
218
- end
219
-
220
- # Raised when the provided IP address is an invalid address.
221
- #
222
- class IPAddr::InvalidAddressError < IPAddr::Error
223
- end
224
-
225
- # Raised when the address family is invalid such as an address with an
226
- # unsupported family, an address with an inconsistent family, or an address
227
- # who's family cannot be determined.
228
- #
229
- class IPAddr::AddressFamilyError < IPAddr::Error
230
- end
231
-
232
- # Raised when the address is an invalid length.
233
- #
234
- class IPAddr::InvalidPrefixError < IPAddr::InvalidAddressError
235
- end
236
-
237
- # 32 bit mask for IPv4
238
- #
239
- IPAddr::IN4MASK: Integer
240
-
241
- # Format string for IPv6
242
- #
243
- IPAddr::IN6FORMAT: String
244
-
245
- # 128 bit mask for IPv6
246
- #
247
- IPAddr::IN6MASK: Integer