rbs 4.0.0.dev.5 → 4.0.1.dev.1
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/.clang-format +1 -0
- data/.github/workflows/c-check.yml +8 -4
- data/.github/workflows/comments.yml +3 -1
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +10 -0
- data/.github/workflows/rust.yml +95 -0
- data/CHANGELOG.md +323 -0
- data/Rakefile +12 -29
- data/Steepfile +1 -0
- data/config.yml +393 -37
- data/core/array.rbs +218 -188
- data/core/basic_object.rbs +9 -8
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +45 -31
- data/core/complex.rbs +52 -40
- data/core/dir.rbs +57 -45
- data/core/encoding.rbs +5 -5
- data/core/enumerable.rbs +96 -91
- data/core/enumerator.rbs +4 -3
- data/core/errno.rbs +3 -2
- data/core/errors.rbs +31 -29
- data/core/exception.rbs +12 -12
- data/core/fiber.rbs +36 -36
- data/core/file.rbs +186 -113
- data/core/file_test.rbs +2 -2
- data/core/float.rbs +41 -32
- data/core/gc.rbs +78 -70
- data/core/hash.rbs +70 -60
- data/core/integer.rbs +32 -28
- data/core/io/buffer.rbs +36 -36
- data/core/io/wait.rbs +7 -7
- data/core/io.rbs +120 -135
- data/core/kernel.rbs +189 -139
- data/core/marshal.rbs +3 -3
- data/core/match_data.rbs +14 -12
- data/core/math.rbs +69 -67
- data/core/method.rbs +6 -6
- data/core/module.rbs +146 -85
- data/core/nil_class.rbs +4 -3
- data/core/numeric.rbs +35 -32
- data/core/object.rbs +6 -8
- data/core/object_space.rbs +11 -10
- data/core/pathname.rbs +131 -81
- data/core/proc.rbs +65 -33
- data/core/process.rbs +219 -201
- data/core/ractor.rbs +15 -11
- data/core/random.rbs +4 -3
- data/core/range.rbs +52 -47
- data/core/rational.rbs +5 -5
- data/core/rbs/unnamed/argf.rbs +58 -51
- data/core/rbs/unnamed/env_class.rbs +18 -13
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +7 -5
- data/core/regexp.rbs +236 -197
- data/core/ruby.rbs +1 -1
- data/core/ruby_vm.rbs +32 -30
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +1 -1
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +5 -3
- data/core/set.rbs +17 -16
- data/core/signal.rbs +2 -2
- data/core/string.rbs +311 -292
- data/core/struct.rbs +26 -25
- data/core/symbol.rbs +25 -24
- data/core/thread.rbs +40 -34
- data/core/time.rbs +47 -42
- data/core/trace_point.rbs +34 -31
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +10 -10
- data/core/warning.rbs +7 -7
- data/docs/collection.md +1 -1
- data/docs/config.md +171 -0
- data/docs/inline.md +110 -4
- data/docs/syntax.md +13 -12
- data/ext/rbs_extension/ast_translation.c +489 -135
- data/ext/rbs_extension/class_constants.c +8 -0
- data/ext/rbs_extension/class_constants.h +4 -0
- data/ext/rbs_extension/legacy_location.c +28 -51
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +12 -20
- data/include/rbs/ast.h +423 -195
- data/include/rbs/lexer.h +2 -2
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +2 -2
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs.h +8 -0
- data/lib/rbs/ast/ruby/annotations.rb +157 -4
- data/lib/rbs/ast/ruby/members.rb +374 -22
- data/lib/rbs/cli/validate.rb +5 -60
- data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
- data/lib/rbs/definition_builder.rb +60 -27
- data/lib/rbs/errors.rb +0 -11
- data/lib/rbs/inline_parser.rb +1 -1
- data/lib/rbs/parser_aux.rb +20 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +1 -26
- data/lib/rbs/prototype/rbi.rb +1 -20
- data/lib/rbs/test/type_check.rb +3 -0
- data/lib/rbs/types.rb +62 -52
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +0 -1
- data/rbs.gemspec +1 -1
- data/rust/.gitignore +1 -0
- data/rust/Cargo.lock +378 -0
- data/rust/Cargo.toml +7 -0
- data/rust/ruby-rbs/Cargo.toml +22 -0
- data/rust/ruby-rbs/build.rs +764 -0
- data/rust/ruby-rbs/examples/locations.rs +60 -0
- data/rust/ruby-rbs/src/lib.rs +1 -0
- data/rust/ruby-rbs/src/node/mod.rs +742 -0
- data/rust/ruby-rbs/tests/sanity.rs +47 -0
- data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
- data/rust/ruby-rbs-sys/Cargo.toml +23 -0
- data/rust/ruby-rbs-sys/build.rs +204 -0
- data/rust/ruby-rbs-sys/src/lib.rs +50 -0
- data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
- data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
- data/rust/ruby-rbs-sys/wrapper.h +1 -0
- data/sig/ast/ruby/annotations.rbs +191 -4
- data/sig/ast/ruby/members.rbs +21 -1
- data/sig/cli/validate.rbs +1 -6
- data/sig/definition_builder.rbs +2 -0
- data/sig/errors.rbs +0 -8
- data/sig/method_types.rbs +1 -1
- data/sig/parser.rbs +17 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/types.rbs +10 -11
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +339 -161
- data/src/lexstate.c +1 -1
- data/src/location.c +7 -47
- data/src/parser.c +674 -480
- data/src/util/rbs_constant_pool.c +0 -4
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
- data/stdlib/cgi-escape/0/escape.rbs +4 -4
- data/stdlib/coverage/0/coverage.rbs +4 -3
- data/stdlib/date/0/date.rbs +33 -28
- data/stdlib/date/0/date_time.rbs +24 -23
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/erb/0/erb.rbs +64 -53
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +138 -125
- data/stdlib/forwardable/0/forwardable.rbs +10 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +135 -108
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +159 -134
- data/stdlib/objspace/0/objspace.rbs +8 -7
- data/stdlib/open-uri/0/open-uri.rbs +8 -8
- data/stdlib/open3/0/open3.rbs +36 -35
- data/stdlib/openssl/0/openssl.rbs +144 -129
- data/stdlib/optparse/0/optparse.rbs +18 -14
- data/stdlib/pathname/0/pathname.rbs +2 -2
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +61 -8
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
- data/stdlib/ripper/0/ripper.rbs +20 -17
- data/stdlib/securerandom/0/securerandom.rbs +1 -1
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/socket/0/addrinfo.rbs +7 -7
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +10 -9
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +1 -1
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +55 -54
- data/stdlib/strscan/0/string_scanner.rbs +46 -44
- data/stdlib/tempfile/0/tempfile.rbs +24 -20
- data/stdlib/time/0/time.rbs +7 -5
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +26 -18
- data/stdlib/uri/0/file.rbs +2 -2
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +4 -4
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- metadata +23 -5
- data/.github/workflows/valgrind.yml +0 -42
data/core/time.rbs
CHANGED
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
# integer. However `localtime` on some platforms doesn't supports negative
|
|
77
77
|
# `time_t` (before 1970).
|
|
78
78
|
#
|
|
79
|
-
# `struct tm` has *tm_year* member to represent years. (
|
|
80
|
-
# year 1900.) It is defined as `int` in the C standard. *tm_year* can
|
|
81
|
-
# years between -2147481748 to 2147485547 if `int` is 32 bit.
|
|
79
|
+
# `struct tm` has *tm_year* member to represent years. (<code>tm_year = 0</code>
|
|
80
|
+
# means the year 1900.) It is defined as `int` in the C standard. *tm_year* can
|
|
81
|
+
# represent years between -2147481748 to 2147485547 if `int` is 32 bit.
|
|
82
82
|
#
|
|
83
83
|
# Ruby supports leap seconds as far as if the C function `localtime` and
|
|
84
84
|
# `gmtime` supports it. They use the tz database in most Unix systems. The tz
|
|
@@ -259,9 +259,9 @@
|
|
|
259
259
|
#
|
|
260
260
|
# Certain `Time` methods accept arguments that specify timezones:
|
|
261
261
|
#
|
|
262
|
-
# * Time.at: keyword argument
|
|
263
|
-
# * Time.new: positional argument `zone` or keyword argument
|
|
264
|
-
# * Time.now: keyword argument
|
|
262
|
+
# * Time.at: keyword argument <code>in:</code>.
|
|
263
|
+
# * Time.new: positional argument `zone` or keyword argument <code>in:</code>.
|
|
264
|
+
# * Time.now: keyword argument <code>in:</code>.
|
|
265
265
|
# * Time#getlocal: positional argument `zone`.
|
|
266
266
|
# * Time#localtime: positional argument `zone`.
|
|
267
267
|
#
|
|
@@ -276,11 +276,11 @@
|
|
|
276
276
|
#
|
|
277
277
|
# ### Hours/Minutes Offsets
|
|
278
278
|
#
|
|
279
|
-
# The zone value may be a string offset from UTC in the form
|
|
280
|
-
#
|
|
279
|
+
# The zone value may be a string offset from UTC in the form
|
|
280
|
+
# <code>'+HH:MM'</code> or <code>'-HH:MM'</code>, where:
|
|
281
281
|
#
|
|
282
|
-
# * `HH` is the 2-digit hour in the range
|
|
283
|
-
# * `MM` is the 2-digit minute in the range
|
|
282
|
+
# * `HH` is the 2-digit hour in the range <code>0..23</code>.
|
|
283
|
+
# * `MM` is the 2-digit minute in the range <code>0..59</code>.
|
|
284
284
|
#
|
|
285
285
|
# Examples:
|
|
286
286
|
#
|
|
@@ -290,8 +290,8 @@
|
|
|
290
290
|
#
|
|
291
291
|
# ### Single-Letter Offsets
|
|
292
292
|
#
|
|
293
|
-
# The zone value may be a letter in the range
|
|
294
|
-
# [List of military time
|
|
293
|
+
# The zone value may be a letter in the range <code>'A'..'I'</code> or
|
|
294
|
+
# <code>'K'..'Z'</code>; see [List of military time
|
|
295
295
|
# zones](https://en.wikipedia.org/wiki/List_of_military_time_zones):
|
|
296
296
|
#
|
|
297
297
|
# t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
# ### Integer Offsets
|
|
305
305
|
#
|
|
306
306
|
# The zone value may be an integer number of seconds in the range
|
|
307
|
-
#
|
|
307
|
+
# <code>-86399..86399</code>:
|
|
308
308
|
#
|
|
309
309
|
# t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
|
|
310
310
|
# Time.at(t, in: -86399) # => 1999-12-31 20:15:02 -235959
|
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
# * `local_to_utc`:
|
|
322
322
|
#
|
|
323
323
|
# Called when Time.new is invoked with `tz` as the value of positional
|
|
324
|
-
# argument `zone` or keyword argument
|
|
324
|
+
# argument `zone` or keyword argument <code>in:</code>.
|
|
325
325
|
#
|
|
326
326
|
# Argument
|
|
327
327
|
# : a [Time-like object](rdoc-ref:Time@Time-Like+Objects).
|
|
@@ -334,8 +334,9 @@
|
|
|
334
334
|
# * `utc_to_local`:
|
|
335
335
|
#
|
|
336
336
|
# Called when Time.at or Time.now is invoked with `tz` as the value for
|
|
337
|
-
# keyword argument
|
|
338
|
-
# with `tz` as the value for positional argument
|
|
337
|
+
# keyword argument <code>in:</code>, and when Time#getlocal or
|
|
338
|
+
# Time#localtime is called with `tz` as the value for positional argument
|
|
339
|
+
# `zone`.
|
|
339
340
|
#
|
|
340
341
|
# The UTC offset will be calculated as the difference between the original
|
|
341
342
|
# time and the returned object as an `Integer`. If the object is in fixed
|
|
@@ -354,7 +355,8 @@
|
|
|
354
355
|
#
|
|
355
356
|
# * `abbr`:
|
|
356
357
|
#
|
|
357
|
-
# Called when Time#strftime is invoked with a format involving
|
|
358
|
+
# Called when Time#strftime is invoked with a format involving
|
|
359
|
+
# <code>%Z</code>.
|
|
358
360
|
#
|
|
359
361
|
# Argument
|
|
360
362
|
# : a [Time-like object](rdoc-ref:Time@Time-Like+Objects).
|
|
@@ -363,11 +365,12 @@
|
|
|
363
365
|
# : a string abbreviation for the timezone name.
|
|
364
366
|
#
|
|
365
367
|
#
|
|
366
|
-
# *
|
|
368
|
+
# * <code>dst?</code>:
|
|
367
369
|
#
|
|
368
370
|
# Called when Time.at or Time.now is invoked with `tz` as the value for
|
|
369
|
-
# keyword argument
|
|
370
|
-
# with `tz` as the value for positional argument
|
|
371
|
+
# keyword argument <code>in:</code>, and when Time#getlocal or
|
|
372
|
+
# Time#localtime is called with `tz` as the value for positional argument
|
|
373
|
+
# `zone`.
|
|
371
374
|
#
|
|
372
375
|
# Argument
|
|
373
376
|
# : a [Time-like object](rdoc-ref:Time@Time-Like+Objects).
|
|
@@ -378,7 +381,7 @@
|
|
|
378
381
|
#
|
|
379
382
|
# * `name`:
|
|
380
383
|
#
|
|
381
|
-
# Called when
|
|
384
|
+
# Called when <code>Marshal.dump(t)</code> is invoked
|
|
382
385
|
#
|
|
383
386
|
# Argument
|
|
384
387
|
# : none.
|
|
@@ -472,7 +475,7 @@ class Time < Object
|
|
|
472
475
|
# Required argument `time` may be either of:
|
|
473
476
|
#
|
|
474
477
|
# * A `Time` object, whose value is the basis for the returned time; also
|
|
475
|
-
# influenced by optional keyword argument
|
|
478
|
+
# influenced by optional keyword argument <code>in:</code> (see below).
|
|
476
479
|
# * A numeric number of [Epoch seconds](rdoc-ref:Time@Epoch+Seconds) for the
|
|
477
480
|
# returned time.
|
|
478
481
|
#
|
|
@@ -490,29 +493,29 @@ class Time < Object
|
|
|
490
493
|
# together to specify subseconds for the returned time; argument `units`
|
|
491
494
|
# specifies the units for `subsec`:
|
|
492
495
|
#
|
|
493
|
-
# *
|
|
496
|
+
# * <code>:millisecond</code>: `subsec` in milliseconds:
|
|
494
497
|
#
|
|
495
498
|
# Time.at(secs, 0, :millisecond) # => 2000-12-31 23:59:59 -0600
|
|
496
499
|
# Time.at(secs, 500, :millisecond) # => 2000-12-31 23:59:59.5 -0600
|
|
497
500
|
# Time.at(secs, 1000, :millisecond) # => 2001-01-01 00:00:00 -0600
|
|
498
501
|
# Time.at(secs, -1000, :millisecond) # => 2000-12-31 23:59:58 -0600
|
|
499
502
|
#
|
|
500
|
-
# *
|
|
503
|
+
# * <code>:microsecond</code> or <code>:usec</code>: `subsec` in microseconds:
|
|
501
504
|
#
|
|
502
505
|
# Time.at(secs, 0, :microsecond) # => 2000-12-31 23:59:59 -0600
|
|
503
506
|
# Time.at(secs, 500000, :microsecond) # => 2000-12-31 23:59:59.5 -0600
|
|
504
507
|
# Time.at(secs, 1000000, :microsecond) # => 2001-01-01 00:00:00 -0600
|
|
505
508
|
# Time.at(secs, -1000000, :microsecond) # => 2000-12-31 23:59:58 -0600
|
|
506
509
|
#
|
|
507
|
-
# *
|
|
510
|
+
# * <code>:nanosecond</code> or <code>:nsec</code>: `subsec` in nanoseconds:
|
|
508
511
|
#
|
|
509
512
|
# Time.at(secs, 0, :nanosecond) # => 2000-12-31 23:59:59 -0600
|
|
510
513
|
# Time.at(secs, 500000000, :nanosecond) # => 2000-12-31 23:59:59.5 -0600
|
|
511
514
|
# Time.at(secs, 1000000000, :nanosecond) # => 2001-01-01 00:00:00 -0600
|
|
512
515
|
# Time.at(secs, -1000000000, :nanosecond) # => 2000-12-31 23:59:58 -0600
|
|
513
516
|
#
|
|
514
|
-
# Optional keyword argument
|
|
515
|
-
# time:
|
|
517
|
+
# Optional keyword argument <code>in: zone</code> specifies the timezone for the
|
|
518
|
+
# returned time:
|
|
516
519
|
#
|
|
517
520
|
# Time.at(secs, in: '+12:00') # => 2001-01-01 17:59:59 +1200
|
|
518
521
|
# Time.at(secs, in: '-12:00') # => 2000-12-31 17:59:59 -1200
|
|
@@ -797,7 +800,7 @@ class Time < Object
|
|
|
797
800
|
# -->
|
|
798
801
|
# Compares `self` with `other_time`; returns:
|
|
799
802
|
#
|
|
800
|
-
# *
|
|
803
|
+
# * <code>-1</code>, if `self` is less than `other_time`.
|
|
801
804
|
# * `0`, if `self` is equal to `other_time`.
|
|
802
805
|
# * `1`, if `self` is greater then `other_time`.
|
|
803
806
|
# * `nil`, if `self` and `other_time` are incomparable.
|
|
@@ -825,9 +828,9 @@ class Time < Object
|
|
|
825
828
|
def >=: (Time arg0) -> bool
|
|
826
829
|
|
|
827
830
|
# <!-- rdoc-file=time.c -->
|
|
828
|
-
# Returns a string representation of `self`, formatted by
|
|
829
|
-
# %Y')
|
|
830
|
-
# Times](rdoc-ref:strftime_formatting.rdoc):
|
|
831
|
+
# Returns a string representation of `self`, formatted by <code>strftime('%a %b
|
|
832
|
+
# %e %T %Y')</code> or its shorthand version <code>strftime('%c')</code>; see
|
|
833
|
+
# [Formats for Dates and Times](rdoc-ref:strftime_formatting.rdoc):
|
|
831
834
|
#
|
|
832
835
|
# t = Time.new(2000, 12, 31, 23, 59, 59, 0.5)
|
|
833
836
|
# t.ctime # => "Sun Dec 31 23:59:59 2000"
|
|
@@ -845,9 +848,9 @@ class Time < Object
|
|
|
845
848
|
# rdoc-file=time.c
|
|
846
849
|
# - ctime -> string
|
|
847
850
|
# -->
|
|
848
|
-
# Returns a string representation of `self`, formatted by
|
|
849
|
-
# %Y')
|
|
850
|
-
# Times](rdoc-ref:strftime_formatting.rdoc):
|
|
851
|
+
# Returns a string representation of `self`, formatted by <code>strftime('%a %b
|
|
852
|
+
# %e %T %Y')</code> or its shorthand version <code>strftime('%c')</code>; see
|
|
853
|
+
# [Formats for Dates and Times](rdoc-ref:strftime_formatting.rdoc):
|
|
851
854
|
#
|
|
852
855
|
# t = Time.new(2000, 12, 31, 23, 59, 59, 0.5)
|
|
853
856
|
# t.ctime # => "Sun Dec 31 23:59:59 2000"
|
|
@@ -877,8 +880,10 @@ class Time < Object
|
|
|
877
880
|
# - deconstruct_keys(array_of_names_or_nil) -> hash
|
|
878
881
|
# -->
|
|
879
882
|
# Returns a hash of the name/value pairs, to use in pattern matching. Possible
|
|
880
|
-
# keys are:
|
|
881
|
-
#
|
|
883
|
+
# keys are: <code>:year</code>, <code>:month</code>, <code>:day</code>,
|
|
884
|
+
# <code>:yday</code>, <code>:wday</code>, <code>:hour</code>, <code>:min</code>,
|
|
885
|
+
# <code>:sec</code>, <code>:subsec</code>, <code>:dst</code>,
|
|
886
|
+
# <code>:zone</code>.
|
|
882
887
|
#
|
|
883
888
|
# Possible usages:
|
|
884
889
|
#
|
|
@@ -1135,9 +1140,9 @@ class Time < Object
|
|
|
1135
1140
|
# # => ["0", "1", "1", "0", "0", "0"]
|
|
1136
1141
|
# Time.new(*a) # => 0000-01-01 00:00:00 -0600
|
|
1137
1142
|
#
|
|
1138
|
-
# When positional argument `zone` or keyword argument
|
|
1139
|
-
# `Time` object is in the specified timezone. For the forms of argument
|
|
1140
|
-
# see [Timezone Specifiers](rdoc-ref:Time@Timezone+Specifiers):
|
|
1143
|
+
# When positional argument `zone` or keyword argument <code>in:</code> is given,
|
|
1144
|
+
# the new `Time` object is in the specified timezone. For the forms of argument
|
|
1145
|
+
# `zone`, see [Timezone Specifiers](rdoc-ref:Time@Timezone+Specifiers):
|
|
1141
1146
|
#
|
|
1142
1147
|
# Time.new(2000, 1, 1, 0, 0, 0, '+12:00')
|
|
1143
1148
|
# # => 2000-01-01 00:00:00 +1200
|
|
@@ -1146,9 +1151,9 @@ class Time < Object
|
|
|
1146
1151
|
# Time.new(in: '-12:00')
|
|
1147
1152
|
# # => 2022-08-23 08:49:26.1941467 -1200
|
|
1148
1153
|
#
|
|
1149
|
-
# Since
|
|
1150
|
-
# argument in single string form contains time zone information, this
|
|
1151
|
-
# argument will be silently ignored.
|
|
1154
|
+
# Since <code>in:</code> keyword argument just provides the default, so if the
|
|
1155
|
+
# first argument in single string form contains time zone information, this
|
|
1156
|
+
# keyword argument will be silently ignored.
|
|
1152
1157
|
#
|
|
1153
1158
|
# Time.new('2000-01-01 00:00:00 +0100', in: '-0500').utc_offset # => 3600
|
|
1154
1159
|
#
|
data/core/trace_point.rbs
CHANGED
|
@@ -21,62 +21,62 @@
|
|
|
21
21
|
# If you don't specify the types of events you want to listen for, TracePoint
|
|
22
22
|
# will include all available events.
|
|
23
23
|
#
|
|
24
|
-
#
|
|
25
|
-
# change. Instead, it is recommended to specify the types of events
|
|
26
|
-
# use.
|
|
24
|
+
# <strong>Note:</strong> Do not depend on the current event set, as this list is
|
|
25
|
+
# subject to change. Instead, it is recommended to specify the types of events
|
|
26
|
+
# you want to use.
|
|
27
27
|
#
|
|
28
28
|
# To filter what is traced, you can pass any number of the following as
|
|
29
29
|
# `events`:
|
|
30
30
|
#
|
|
31
|
-
#
|
|
31
|
+
# <code>:line</code>
|
|
32
32
|
# : Execute an expression or statement on a new line.
|
|
33
33
|
#
|
|
34
|
-
#
|
|
34
|
+
# <code>:class</code>
|
|
35
35
|
# : Start a class or module definition.
|
|
36
36
|
#
|
|
37
|
-
#
|
|
37
|
+
# <code>:end</code>
|
|
38
38
|
# : Finish a class or module definition.
|
|
39
39
|
#
|
|
40
|
-
#
|
|
40
|
+
# <code>:call</code>
|
|
41
41
|
# : Call a Ruby method.
|
|
42
42
|
#
|
|
43
|
-
#
|
|
43
|
+
# <code>:return</code>
|
|
44
44
|
# : Return from a Ruby method.
|
|
45
45
|
#
|
|
46
|
-
#
|
|
46
|
+
# <code>:c_call</code>
|
|
47
47
|
# : Call a C-language routine.
|
|
48
48
|
#
|
|
49
|
-
#
|
|
49
|
+
# <code>:c_return</code>
|
|
50
50
|
# : Return from a C-language routine.
|
|
51
51
|
#
|
|
52
|
-
#
|
|
52
|
+
# <code>:raise</code>
|
|
53
53
|
# : Raise an exception.
|
|
54
54
|
#
|
|
55
|
-
#
|
|
55
|
+
# <code>:rescue</code>
|
|
56
56
|
# : Rescue an exception.
|
|
57
57
|
#
|
|
58
|
-
#
|
|
58
|
+
# <code>:b_call</code>
|
|
59
59
|
# : Event hook at block entry.
|
|
60
60
|
#
|
|
61
|
-
#
|
|
61
|
+
# <code>:b_return</code>
|
|
62
62
|
# : Event hook at block ending.
|
|
63
63
|
#
|
|
64
|
-
#
|
|
64
|
+
# <code>:a_call</code>
|
|
65
65
|
# : Event hook at all calls (`call`, `b_call`, and `c_call`).
|
|
66
66
|
#
|
|
67
|
-
#
|
|
67
|
+
# <code>:a_return</code>
|
|
68
68
|
# : Event hook at all returns (`return`, `b_return`, and `c_return`).
|
|
69
69
|
#
|
|
70
|
-
#
|
|
70
|
+
# <code>:thread_begin</code>
|
|
71
71
|
# : Event hook at thread beginning.
|
|
72
72
|
#
|
|
73
|
-
#
|
|
73
|
+
# <code>:thread_end</code>
|
|
74
74
|
# : Event hook at thread ending.
|
|
75
75
|
#
|
|
76
|
-
#
|
|
76
|
+
# <code>:fiber_switch</code>
|
|
77
77
|
# : Event hook at fiber switch.
|
|
78
78
|
#
|
|
79
|
-
#
|
|
79
|
+
# <code>:script_compiled</code>
|
|
80
80
|
# : New Ruby code compiled (with `eval`, `load`, or `require`).
|
|
81
81
|
#
|
|
82
82
|
class TracePoint
|
|
@@ -140,7 +140,7 @@ class TracePoint
|
|
|
140
140
|
#
|
|
141
141
|
# If called when reentrance is already allowed, it raises a RuntimeError.
|
|
142
142
|
#
|
|
143
|
-
#
|
|
143
|
+
# <strong>Example:</strong>
|
|
144
144
|
#
|
|
145
145
|
# # Without reentry
|
|
146
146
|
# # ---------------
|
|
@@ -223,8 +223,8 @@ class TracePoint
|
|
|
223
223
|
# -->
|
|
224
224
|
# Returns the generated binding object from the event.
|
|
225
225
|
#
|
|
226
|
-
# Note that for
|
|
227
|
-
# since C methods themselves do not have bindings.
|
|
226
|
+
# Note that for <code>:c_call</code> and <code>:c_return</code> events, the
|
|
227
|
+
# method returns `nil`, since C methods themselves do not have bindings.
|
|
228
228
|
#
|
|
229
229
|
def binding: () -> Binding?
|
|
230
230
|
|
|
@@ -259,12 +259,13 @@ class TracePoint
|
|
|
259
259
|
# C.new.foo
|
|
260
260
|
# end
|
|
261
261
|
#
|
|
262
|
-
#
|
|
262
|
+
# <strong>Note:</strong> #defined_class returns the singleton class.
|
|
263
263
|
#
|
|
264
264
|
# The 6th block parameter of Kernel#set_trace_func passes the original class
|
|
265
265
|
# attached by the singleton class.
|
|
266
266
|
#
|
|
267
|
-
#
|
|
267
|
+
# <strong>This is a difference between Kernel#set_trace_func and
|
|
268
|
+
# TracePoint.</strong>
|
|
268
269
|
#
|
|
269
270
|
# class C; def self.foo; end; end
|
|
270
271
|
# trace = TracePoint.new(:call) do |tp|
|
|
@@ -432,8 +433,8 @@ class TracePoint
|
|
|
432
433
|
# rdoc-file=trace_point.rb
|
|
433
434
|
# - raised_exception()
|
|
434
435
|
# -->
|
|
435
|
-
# Returns the exception raised on the
|
|
436
|
-
# event.
|
|
436
|
+
# Returns the exception raised on the <code>:raise</code> event or rescued on
|
|
437
|
+
# the <code>:rescue</code> event.
|
|
437
438
|
#
|
|
438
439
|
def raised_exception: () -> Exception
|
|
439
440
|
|
|
@@ -441,7 +442,8 @@ class TracePoint
|
|
|
441
442
|
# rdoc-file=trace_point.rb
|
|
442
443
|
# - return_value()
|
|
443
444
|
# -->
|
|
444
|
-
# Returns the return value from
|
|
445
|
+
# Returns the return value from <code>:return</code>, <code>:c_return</code>,
|
|
446
|
+
# and <code>:b_return</code> events.
|
|
445
447
|
#
|
|
446
448
|
def return_value: () -> untyped
|
|
447
449
|
|
|
@@ -452,7 +454,7 @@ class TracePoint
|
|
|
452
454
|
# Returns the trace object during the event.
|
|
453
455
|
#
|
|
454
456
|
# Similar to the following, but it returns the correct object (the method
|
|
455
|
-
# receiver) for
|
|
457
|
+
# receiver) for <code>:c_call</code> and <code>:c_return</code> events:
|
|
456
458
|
#
|
|
457
459
|
# trace.binding.eval('self')
|
|
458
460
|
#
|
|
@@ -463,7 +465,7 @@ class TracePoint
|
|
|
463
465
|
# - eval_script()
|
|
464
466
|
# -->
|
|
465
467
|
# Returns the compiled source code (String) from eval methods on the
|
|
466
|
-
#
|
|
468
|
+
# <code>:script_compiled</code> event. If loaded from a file, it returns `nil`.
|
|
467
469
|
#
|
|
468
470
|
def eval_script: () -> String?
|
|
469
471
|
|
|
@@ -472,7 +474,8 @@ class TracePoint
|
|
|
472
474
|
# - instruction_sequence()
|
|
473
475
|
# -->
|
|
474
476
|
# Returns the compiled instruction sequence represented by a
|
|
475
|
-
# RubyVM::InstructionSequence instance on the
|
|
477
|
+
# RubyVM::InstructionSequence instance on the <code>:script_compiled</code>
|
|
478
|
+
# event.
|
|
476
479
|
#
|
|
477
480
|
# Note that this method is CRuby-specific.
|
|
478
481
|
#
|
data/core/true_class.rbs
CHANGED
|
@@ -58,7 +58,7 @@ class TrueClass
|
|
|
58
58
|
| (untyped obj) -> bool
|
|
59
59
|
|
|
60
60
|
# <!-- rdoc-file=object.c -->
|
|
61
|
-
# Returns string
|
|
61
|
+
# Returns string <code>'true'</code>:
|
|
62
62
|
#
|
|
63
63
|
# true.to_s # => "true"
|
|
64
64
|
#
|
|
@@ -70,7 +70,7 @@ class TrueClass
|
|
|
70
70
|
# rdoc-file=object.c
|
|
71
71
|
# - true.to_s -> 'true'
|
|
72
72
|
# -->
|
|
73
|
-
# Returns string
|
|
73
|
+
# Returns string <code>'true'</code>:
|
|
74
74
|
#
|
|
75
75
|
# true.to_s # => "true"
|
|
76
76
|
#
|
data/core/unbound_method.rbs
CHANGED
|
@@ -150,7 +150,7 @@ class UnboundMethod
|
|
|
150
150
|
# - umeth.bind(obj) -> method
|
|
151
151
|
# -->
|
|
152
152
|
# Bind *umeth* to *obj*. If Klass was the class from which *umeth* was obtained,
|
|
153
|
-
#
|
|
153
|
+
# <code>obj.kind_of?(Klass)</code> must be true.
|
|
154
154
|
#
|
|
155
155
|
# class A
|
|
156
156
|
# def test
|
|
@@ -170,7 +170,7 @@ class UnboundMethod
|
|
|
170
170
|
# bm = um.bind(A.new)
|
|
171
171
|
# bm.call
|
|
172
172
|
#
|
|
173
|
-
#
|
|
173
|
+
# <em>produces:</em>
|
|
174
174
|
#
|
|
175
175
|
# In test, class = C
|
|
176
176
|
# In test, class = B
|
|
@@ -199,12 +199,12 @@ class UnboundMethod
|
|
|
199
199
|
# Net::HTTP.method(:get).inspect
|
|
200
200
|
# #=> "#<Method: Net::HTTP.get(uri_or_host, path=..., port=...) <skip>/lib/ruby/2.7.0/net/http.rb:457>"
|
|
201
201
|
#
|
|
202
|
-
#
|
|
203
|
-
# value).
|
|
202
|
+
# <code>...</code> in argument definition means argument is optional (has some
|
|
203
|
+
# default value).
|
|
204
204
|
#
|
|
205
205
|
# For methods defined in C (language core and extensions), location and argument
|
|
206
206
|
# names can't be extracted, and only generic information is provided in form of
|
|
207
|
-
#
|
|
207
|
+
# <code>*</code> (any number of arguments) or `_` (some positional argument).
|
|
208
208
|
#
|
|
209
209
|
# "cat".method(:count).inspect #=> "#<Method: String#count(*)>"
|
|
210
210
|
# "cat".method(:+).inspect #=> "#<Method: String#+(_)>""
|
|
@@ -227,12 +227,12 @@ class UnboundMethod
|
|
|
227
227
|
# Net::HTTP.method(:get).inspect
|
|
228
228
|
# #=> "#<Method: Net::HTTP.get(uri_or_host, path=..., port=...) <skip>/lib/ruby/2.7.0/net/http.rb:457>"
|
|
229
229
|
#
|
|
230
|
-
#
|
|
231
|
-
# value).
|
|
230
|
+
# <code>...</code> in argument definition means argument is optional (has some
|
|
231
|
+
# default value).
|
|
232
232
|
#
|
|
233
233
|
# For methods defined in C (language core and extensions), location and argument
|
|
234
234
|
# names can't be extracted, and only generic information is provided in form of
|
|
235
|
-
#
|
|
235
|
+
# <code>*</code> (any number of arguments) or `_` (some positional argument).
|
|
236
236
|
#
|
|
237
237
|
# "cat".method(:count).inspect #=> "#<Method: String#count(*)>"
|
|
238
238
|
# "cat".method(:+).inspect #=> "#<Method: String#+(_)>""
|
|
@@ -330,8 +330,8 @@ class UnboundMethod
|
|
|
330
330
|
# - umeth.bind_call(recv, args, ...) -> obj
|
|
331
331
|
# -->
|
|
332
332
|
# Bind *umeth* to *recv* and then invokes the method with the specified
|
|
333
|
-
# arguments. This is semantically equivalent to
|
|
334
|
-
# ...)
|
|
333
|
+
# arguments. This is semantically equivalent to
|
|
334
|
+
# <code>umeth.bind(recv).call(args, ...)</code>.
|
|
335
335
|
#
|
|
336
336
|
def bind_call: (untyped recv, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
|
|
337
337
|
end
|
data/core/warning.rbs
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
#
|
|
6
6
|
# Changing the behavior of Warning.warn is useful to customize how warnings are
|
|
7
7
|
# handled by Ruby, for instance by filtering some warnings, and/or outputting
|
|
8
|
-
# warnings somewhere other than
|
|
8
|
+
# warnings somewhere other than <code>$stderr</code>.
|
|
9
9
|
#
|
|
10
10
|
# If you want to change the behavior of Warning.warn you should use
|
|
11
|
-
#
|
|
12
|
-
# default behavior of printing the warning to
|
|
11
|
+
# <code>Warning.extend(MyNewModuleWithWarnMethod)</code> and you can use `super`
|
|
12
|
+
# to get the default behavior of printing the warning to <code>$stderr</code>.
|
|
13
13
|
#
|
|
14
14
|
# Example:
|
|
15
15
|
# module MyWarningFilter
|
|
@@ -41,18 +41,18 @@ module Warning
|
|
|
41
41
|
# Returns the flag to show the warning messages for `category`. Supported
|
|
42
42
|
# categories are:
|
|
43
43
|
#
|
|
44
|
-
#
|
|
44
|
+
# <code>:deprecated</code>
|
|
45
45
|
# : deprecation warnings
|
|
46
|
-
# * assignment of non-nil value to
|
|
46
|
+
# * assignment of non-nil value to <code>$,</code> and <code>$;</code>
|
|
47
47
|
# * keyword arguments
|
|
48
48
|
# etc.
|
|
49
49
|
#
|
|
50
50
|
#
|
|
51
|
-
#
|
|
51
|
+
# <code>:experimental</code>
|
|
52
52
|
# : experimental features
|
|
53
53
|
#
|
|
54
54
|
#
|
|
55
|
-
#
|
|
55
|
+
# <code>:performance</code>
|
|
56
56
|
# : performance hints
|
|
57
57
|
# * Shape variation limit
|
|
58
58
|
#
|
data/docs/collection.md
CHANGED
|
@@ -189,4 +189,4 @@ If the gem's RBS is included in the gem package, put it as `sig/manifest.yaml`.
|
|
|
189
189
|
## How it works
|
|
190
190
|
|
|
191
191
|
`rbs collection` is integrated with Bundler.
|
|
192
|
-
`rbs collection install` command generates `
|
|
192
|
+
`rbs collection install` command generates `rbs_collection.lock.yaml` from `rbs_collection.yaml` and `Gemfile.lock`. It uses `Gemfile.lock` to detects dependencies.
|