rbs 2.0.0 → 2.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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +23 -0
- data/README.md +6 -1
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +472 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1059 -139
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2315 -316
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/cli.rb +45 -1
- data/lib/rbs/definition_builder.rb +5 -1
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +59 -0
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1146 -144
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/net-http.rbs +1492 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +420 -106
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +556 -327
- data/stdlib/uri/0/http.rbs +26 -115
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +17 -5
- 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.
|
|
110
|
-
#
|
|
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
|