rbs 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -0
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +6 -1
  5. data/core/array.rbs +2866 -1086
  6. data/core/basic_object.rbs +150 -30
  7. data/core/binding.rbs +33 -0
  8. data/core/builtin.rbs +4 -4
  9. data/core/class.rbs +43 -5
  10. data/core/comparable.rbs +57 -0
  11. data/core/complex.rbs +170 -4
  12. data/core/constants.rbs +51 -0
  13. data/core/deprecated.rbs +7 -0
  14. data/core/dir.rbs +305 -20
  15. data/core/encoding.rbs +472 -77
  16. data/core/enumerable.rbs +2173 -234
  17. data/core/enumerator.rbs +448 -182
  18. data/core/env.rbs +448 -1
  19. data/core/errno.rbs +1 -10
  20. data/core/errors.rbs +152 -2
  21. data/core/exception.rbs +201 -127
  22. data/core/false_class.rbs +27 -0
  23. data/core/fiber.rbs +118 -37
  24. data/core/fiber_error.rbs +8 -9
  25. data/core/file.rbs +1059 -139
  26. data/core/file_test.rbs +287 -32
  27. data/core/float.rbs +776 -300
  28. data/core/gc.rbs +185 -34
  29. data/core/global_variables.rbs +5 -1
  30. data/core/hash.rbs +1582 -649
  31. data/core/integer.rbs +974 -204
  32. data/core/io/buffer.rbs +710 -0
  33. data/core/io/wait.rbs +29 -8
  34. data/core/io.rbs +2438 -417
  35. data/core/kernel.rbs +2315 -316
  36. data/core/marshal.rbs +37 -2
  37. data/core/match_data.rbs +123 -6
  38. data/core/math.rbs +126 -6
  39. data/core/method.rbs +226 -102
  40. data/core/module.rbs +421 -45
  41. data/core/nil_class.rbs +64 -0
  42. data/core/numeric.rbs +620 -142
  43. data/core/object.rbs +453 -81
  44. data/core/object_space.rbs +92 -2
  45. data/core/proc.rbs +482 -285
  46. data/core/process.rbs +443 -34
  47. data/core/ractor.rbs +232 -9
  48. data/core/random.rbs +151 -52
  49. data/core/range.rbs +885 -160
  50. data/core/rational.rbs +122 -6
  51. data/core/rb_config.rbs +14 -4
  52. data/core/refinement.rbs +44 -0
  53. data/core/regexp.rbs +156 -14
  54. data/core/ruby_vm.rbs +42 -3
  55. data/core/signal.rbs +78 -39
  56. data/core/string.rbs +2123 -567
  57. data/core/string_io.rbs +204 -0
  58. data/core/struct.rbs +283 -28
  59. data/core/symbol.rbs +304 -30
  60. data/core/thread.rbs +1288 -688
  61. data/core/thread_group.rbs +66 -10
  62. data/core/time.rbs +643 -217
  63. data/core/trace_point.rbs +100 -12
  64. data/core/true_class.rbs +24 -0
  65. data/core/unbound_method.rbs +73 -7
  66. data/core/warning.rbs +37 -12
  67. data/docs/CONTRIBUTING.md +40 -34
  68. data/docs/stdlib.md +3 -102
  69. data/lib/rbs/annotate/annotations.rb +197 -0
  70. data/lib/rbs/annotate/formatter.rb +80 -0
  71. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  72. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  73. data/lib/rbs/annotate.rb +6 -0
  74. data/lib/rbs/cli.rb +45 -1
  75. data/lib/rbs/definition_builder.rb +5 -1
  76. data/lib/rbs/location_aux.rb +12 -0
  77. data/lib/rbs/prototype/rb.rb +12 -0
  78. data/lib/rbs/version.rb +1 -1
  79. data/sig/annotate/annotations.rbs +102 -0
  80. data/sig/annotate/formatter.rbs +24 -0
  81. data/sig/annotate/rdoc_annotater.rbs +82 -0
  82. data/sig/annotate/rdoc_source.rbs +30 -0
  83. data/sig/cli.rbs +2 -0
  84. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  85. data/sig/location.rbs +6 -0
  86. data/sig/method_types.rbs +5 -1
  87. data/sig/polyfill.rbs +78 -0
  88. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  89. data/stdlib/abbrev/0/array.rbs +26 -0
  90. data/stdlib/base64/0/base64.rbs +31 -0
  91. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  92. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  93. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  94. data/stdlib/cgi/0/core.rbs +59 -0
  95. data/stdlib/coverage/0/coverage.rbs +164 -2
  96. data/stdlib/csv/0/csv.rbs +2862 -398
  97. data/stdlib/date/0/date.rbs +483 -25
  98. data/stdlib/date/0/date_time.rbs +187 -12
  99. data/stdlib/dbm/0/dbm.rbs +152 -17
  100. data/stdlib/digest/0/digest.rbs +146 -0
  101. data/stdlib/erb/0/erb.rbs +65 -245
  102. data/stdlib/fiber/0/fiber.rbs +73 -91
  103. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  104. data/stdlib/find/0/find.rbs +9 -0
  105. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  106. data/stdlib/io-console/0/io-console.rbs +227 -15
  107. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  108. data/stdlib/json/0/json.rbs +1146 -144
  109. data/stdlib/logger/0/formatter.rbs +24 -0
  110. data/stdlib/logger/0/log_device.rbs +64 -0
  111. data/stdlib/logger/0/logger.rbs +165 -13
  112. data/stdlib/logger/0/period.rbs +10 -0
  113. data/stdlib/logger/0/severity.rbs +26 -0
  114. data/stdlib/monitor/0/monitor.rbs +163 -0
  115. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  116. data/stdlib/net-http/0/net-http.rbs +1492 -683
  117. data/stdlib/nkf/0/nkf.rbs +372 -0
  118. data/stdlib/objspace/0/objspace.rbs +149 -90
  119. data/stdlib/openssl/0/openssl.rbs +8108 -71
  120. data/stdlib/optparse/0/optparse.rbs +487 -19
  121. data/stdlib/pathname/0/pathname.rbs +425 -124
  122. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  123. data/stdlib/prime/0/integer-extension.rbs +20 -2
  124. data/stdlib/prime/0/prime.rbs +88 -21
  125. data/stdlib/pstore/0/pstore.rbs +102 -0
  126. data/stdlib/pty/0/pty.rbs +64 -14
  127. data/stdlib/resolv/0/resolv.rbs +420 -31
  128. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  129. data/stdlib/rubygems/0/config_file.rbs +33 -1
  130. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  131. data/stdlib/rubygems/0/installer.rbs +13 -1
  132. data/stdlib/rubygems/0/path_support.rbs +4 -1
  133. data/stdlib/rubygems/0/platform.rbs +5 -1
  134. data/stdlib/rubygems/0/request_set.rbs +44 -2
  135. data/stdlib/rubygems/0/requirement.rbs +65 -2
  136. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  137. data/stdlib/rubygems/0/source_list.rbs +13 -0
  138. data/stdlib/rubygems/0/specification.rbs +21 -1
  139. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  140. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  141. data/stdlib/rubygems/0/version.rbs +60 -157
  142. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  143. data/stdlib/set/0/set.rbs +420 -106
  144. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  145. data/stdlib/singleton/0/singleton.rbs +20 -0
  146. data/stdlib/socket/0/addrinfo.rbs +210 -9
  147. data/stdlib/socket/0/basic_socket.rbs +103 -11
  148. data/stdlib/socket/0/ip_socket.rbs +31 -9
  149. data/stdlib/socket/0/socket.rbs +586 -38
  150. data/stdlib/socket/0/tcp_server.rbs +22 -2
  151. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  152. data/stdlib/socket/0/udp_socket.rbs +25 -2
  153. data/stdlib/socket/0/unix_server.rbs +22 -2
  154. data/stdlib/socket/0/unix_socket.rbs +45 -5
  155. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  156. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  157. data/stdlib/time/0/time.rbs +208 -116
  158. data/stdlib/timeout/0/timeout.rbs +10 -0
  159. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  160. data/stdlib/tsort/0/cyclic.rbs +1 -0
  161. data/stdlib/tsort/0/interfaces.rbs +1 -0
  162. data/stdlib/tsort/0/tsort.rbs +42 -0
  163. data/stdlib/uri/0/common.rbs +57 -8
  164. data/stdlib/uri/0/file.rbs +55 -109
  165. data/stdlib/uri/0/ftp.rbs +6 -3
  166. data/stdlib/uri/0/generic.rbs +556 -327
  167. data/stdlib/uri/0/http.rbs +26 -115
  168. data/stdlib/uri/0/https.rbs +8 -102
  169. data/stdlib/uri/0/ldap.rbs +143 -137
  170. data/stdlib/uri/0/ldaps.rbs +8 -102
  171. data/stdlib/uri/0/mailto.rbs +3 -0
  172. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  173. data/stdlib/uri/0/ws.rbs +6 -3
  174. data/stdlib/uri/0/wss.rbs +5 -3
  175. data/stdlib/yaml/0/dbm.rbs +151 -87
  176. data/stdlib/yaml/0/store.rbs +6 -0
  177. data/stdlib/zlib/0/zlib.rbs +90 -31
  178. metadata +17 -5
  179. data/lib/rbs/location.rb +0 -221
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=lib/benchmark.rb -->
1
2
  # The Benchmark module provides methods to measure and report the time used to
2
3
  # execute Ruby code.
3
4
  #
@@ -101,13 +102,19 @@
101
102
  # >total: 2.880000 0.000000 2.880000 ( 2.883764)
102
103
  # >avg: 0.960000 0.000000 0.960000 ( 0.961255)
103
104
  #
104
- #
105
105
  module Benchmark
106
+ # <!--
107
+ # rdoc-file=lib/benchmark.rb
108
+ # - benchmark(caption = "", label_width = nil, format = nil, *labels) { |report| ... }
109
+ # -->
106
110
  # Invokes the block with a Benchmark::Report object, which may be used to
107
111
  # collect and report on the results of individual benchmark tests. Reserves
108
112
  # `label_width` leading spaces for labels on each line. Prints `caption` at the
109
- # top of the report, and uses `format` to format each line. Returns an array of
110
- # Benchmark::Tms objects.
113
+ # top of the report, and uses `format` to format each line. (Note: `caption`
114
+ # must contain a terminating newline character, see the default
115
+ # Benchmark::Tms::CAPTION for an example.)
116
+ #
117
+ # Returns an array of Benchmark::Tms objects.
111
118
  #
112
119
  # If the block returns an array of Benchmark::Tms objects, these will be used to
113
120
  # format additional lines of output. If `labels` parameter are given, these are
@@ -141,6 +148,10 @@ module Benchmark
141
148
  #
142
149
  def self?.benchmark: (String caption, ?Integer? label_width, ?String? format, *String labels) { (Report report) -> (Array[Tms] | void) } -> Array[Tms]
143
150
 
151
+ # <!--
152
+ # rdoc-file=lib/benchmark.rb
153
+ # - bm(label_width = 0, *labels) { |report| ... }
154
+ # -->
144
155
  # A simple interface to the #benchmark method, #bm generates sequential reports
145
156
  # with labels. `label_width` and `labels` parameters have the same meaning as
146
157
  # for #benchmark.
@@ -163,6 +174,10 @@ module Benchmark
163
174
  #
164
175
  def self?.bm: (?Integer label_width, *String labels) { (Report report) -> void } -> Array[Tms]
165
176
 
177
+ # <!--
178
+ # rdoc-file=lib/benchmark.rb
179
+ # - bmbm(width = 0) { |job| ... }
180
+ # -->
166
181
  # Sometimes benchmark results are skewed because code executed earlier
167
182
  # encounters different garbage collection overheads than that run later. #bmbm
168
183
  # attempts to minimize this effect by running the tests twice, the first time as
@@ -200,6 +215,10 @@ module Benchmark
200
215
  #
201
216
  def self?.bmbm: (?Integer width) { (Job job) -> void } -> Array[Tms]
202
217
 
218
+ # <!--
219
+ # rdoc-file=lib/benchmark.rb
220
+ # - measure(label = "") { || ... }
221
+ # -->
203
222
  # Returns the time used to execute the given block as a Benchmark::Tms object.
204
223
  # Takes `label` option.
205
224
  #
@@ -218,16 +237,22 @@ module Benchmark
218
237
  #
219
238
  def self?.measure: (?String label) { () -> void } -> Tms
220
239
 
240
+ # <!--
241
+ # rdoc-file=lib/benchmark.rb
242
+ # - realtime() { || ... }
243
+ # -->
221
244
  # Returns the elapsed real time used to execute the given block.
222
245
  #
223
246
  def self?.realtime: () { () -> void } -> Float
224
247
 
225
248
  BENCHMARK_VERSION: String
226
249
 
250
+ # <!-- rdoc-file=lib/benchmark.rb -->
227
251
  # The default caption string (heading above the output times).
228
252
  #
229
253
  CAPTION: String
230
254
 
255
+ # <!-- rdoc-file=lib/benchmark.rb -->
231
256
  # The default format string used to display times. See also
232
257
  # Benchmark::Tms#format.
233
258
  #
@@ -260,50 +285,81 @@ module Benchmark
260
285
  alias report item
261
286
  end
262
287
 
288
+ # <!-- rdoc-file=lib/benchmark.rb -->
263
289
  # A data object, representing the times associated with a benchmark measurement.
264
290
  #
265
291
  class Tms
292
+ # <!--
293
+ # rdoc-file=lib/benchmark.rb
294
+ # - *(x)
295
+ # -->
266
296
  # Returns a new Tms object obtained by memberwise multiplication of the
267
297
  # individual times for this Tms object by `x`.
268
298
  #
269
299
  def *: (untyped x) -> untyped
270
300
 
301
+ # <!--
302
+ # rdoc-file=lib/benchmark.rb
303
+ # - +(other)
304
+ # -->
271
305
  # Returns a new Tms object obtained by memberwise summation of the individual
272
306
  # times for this Tms object with those of the `other` Tms object. This method
273
307
  # and #/() are useful for taking statistics.
274
308
  #
275
309
  def +: (untyped other) -> untyped
276
310
 
311
+ # <!--
312
+ # rdoc-file=lib/benchmark.rb
313
+ # - -(other)
314
+ # -->
277
315
  # Returns a new Tms object obtained by memberwise subtraction of the individual
278
316
  # times for the `other` Tms object from those of this Tms object.
279
317
  #
280
318
  def -: (untyped other) -> untyped
281
319
 
320
+ # <!--
321
+ # rdoc-file=lib/benchmark.rb
322
+ # - /(x)
323
+ # -->
282
324
  # Returns a new Tms object obtained by memberwise division of the individual
283
325
  # times for this Tms object by `x`. This method and #+() are useful for taking
284
326
  # statistics.
285
327
  #
286
328
  def /: (untyped x) -> untyped
287
329
 
330
+ # <!--
331
+ # rdoc-file=lib/benchmark.rb
332
+ # - add() { || ... }
333
+ # -->
288
334
  # Returns a new Tms object whose times are the sum of the times for this Tms
289
335
  # object, plus the time required to execute the code block (`blk`).
290
336
  #
291
337
  def add: () { (*untyped) -> untyped } -> untyped
292
338
 
339
+ # <!--
340
+ # rdoc-file=lib/benchmark.rb
341
+ # - add!(&blk)
342
+ # -->
293
343
  # An in-place version of #add. Changes the times of this Tms object by making it
294
344
  # the sum of the times for this Tms object, plus the time required to execute
295
345
  # the code block (`blk`).
296
346
  #
297
347
  def add!: () { (*untyped) -> untyped } -> untyped
298
348
 
349
+ # <!-- rdoc-file=lib/benchmark.rb -->
299
350
  # System CPU time of children
300
351
  #
301
352
  def cstime: () -> Float
302
353
 
354
+ # <!-- rdoc-file=lib/benchmark.rb -->
303
355
  # User CPU time of children
304
356
  #
305
357
  def cutime: () -> Float
306
358
 
359
+ # <!--
360
+ # rdoc-file=lib/benchmark.rb
361
+ # - format(format = nil, *args)
362
+ # -->
307
363
  # Returns the contents of this Tms object as a formatted string, according to a
308
364
  # `format` string like that passed to Kernel.format. In addition, #format
309
365
  # accepts the following extensions:
@@ -331,40 +387,55 @@ module Benchmark
331
387
  #
332
388
  def format: (?String format, *untyped args) -> String
333
389
 
390
+ # <!-- rdoc-file=lib/benchmark.rb -->
334
391
  # Label
335
392
  #
336
393
  def label: () -> String
337
394
 
395
+ # <!-- rdoc-file=lib/benchmark.rb -->
338
396
  # Elapsed real time
339
397
  #
340
398
  def real: () -> Float
341
399
 
400
+ # <!-- rdoc-file=lib/benchmark.rb -->
342
401
  # System CPU time
343
402
  #
344
403
  def stime: () -> Float
345
404
 
405
+ # <!--
406
+ # rdoc-file=lib/benchmark.rb
407
+ # - to_a()
408
+ # -->
346
409
  # Returns a new 6-element array, consisting of the label, user CPU time, system
347
410
  # CPU time, children's user CPU time, children's system CPU time and elapsed
348
411
  # real time.
349
412
  #
350
413
  def to_a: () -> untyped
351
414
 
415
+ # <!--
416
+ # rdoc-file=lib/benchmark.rb
417
+ # - to_s()
418
+ # -->
352
419
  # Same as #format.
353
420
  #
354
421
  def to_s: () -> String
355
422
 
423
+ # <!-- rdoc-file=lib/benchmark.rb -->
356
424
  # Total time, that is `utime` + `stime` + `cutime` + `cstime`
357
425
  #
358
426
  def total: () -> Float
359
427
 
428
+ # <!-- rdoc-file=lib/benchmark.rb -->
360
429
  # User CPU time
361
430
  #
362
431
  def utime: () -> Float
363
432
 
433
+ # <!-- rdoc-file=lib/benchmark.rb -->
364
434
  # Default caption, see also Benchmark::CAPTION
365
435
  #
366
436
  CAPTION: String
367
437
 
438
+ # <!-- rdoc-file=lib/benchmark.rb -->
368
439
  # Default format string, see also Benchmark::FORMAT
369
440
  #
370
441
  FORMAT: String