rbs 4.0.0.dev.4 → 4.0.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/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +18 -11
- data/.github/workflows/comments.yml +5 -3
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/ruby.yml +27 -34
- data/.github/workflows/rust.yml +95 -0
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/windows.yml +2 -2
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +323 -0
- data/README.md +1 -1
- data/Rakefile +43 -33
- data/Steepfile +1 -0
- data/config.yml +426 -24
- data/core/array.rbs +307 -227
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +55 -34
- data/core/complex.rbs +104 -78
- data/core/dir.rbs +61 -49
- data/core/encoding.rbs +12 -15
- data/core/enumerable.rbs +179 -87
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +65 -2
- data/core/errno.rbs +11 -2
- data/core/errors.rbs +58 -29
- data/core/exception.rbs +13 -13
- data/core/fiber.rbs +74 -54
- data/core/file.rbs +280 -177
- data/core/file_test.rbs +3 -3
- data/core/float.rbs +257 -92
- data/core/gc.rbs +425 -281
- data/core/hash.rbs +1045 -739
- data/core/integer.rbs +135 -137
- data/core/io/buffer.rbs +53 -42
- data/core/io/wait.rbs +13 -35
- data/core/io.rbs +192 -144
- data/core/kernel.rbs +216 -155
- data/core/marshal.rbs +4 -4
- data/core/match_data.rbs +15 -13
- data/core/math.rbs +107 -66
- data/core/method.rbs +69 -33
- data/core/module.rbs +244 -106
- data/core/nil_class.rbs +7 -6
- data/core/numeric.rbs +74 -63
- data/core/object.rbs +9 -11
- data/core/object_space.rbs +30 -23
- data/core/pathname.rbs +1322 -0
- data/core/proc.rbs +95 -58
- data/core/process.rbs +222 -202
- data/core/ractor.rbs +371 -515
- data/core/random.rbs +21 -3
- data/core/range.rbs +159 -57
- data/core/rational.rbs +60 -89
- data/core/rbs/unnamed/argf.rbs +60 -53
- data/core/rbs/unnamed/env_class.rbs +19 -14
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +11 -118
- data/core/regexp.rbs +258 -214
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +38 -34
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +4 -71
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +16 -82
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +490 -360
- data/core/signal.rbs +26 -16
- data/core/string.rbs +3234 -1285
- data/core/struct.rbs +27 -26
- data/core/symbol.rbs +41 -34
- data/core/thread.rbs +135 -67
- data/core/time.rbs +81 -50
- data/core/trace_point.rbs +41 -35
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +24 -16
- data/core/warning.rbs +7 -7
- data/docs/aliases.md +79 -0
- data/docs/collection.md +3 -3
- data/docs/config.md +171 -0
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +576 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +46 -16
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +544 -116
- data/ext/rbs_extension/ast_translation.h +3 -0
- data/ext/rbs_extension/class_constants.c +16 -2
- data/ext/rbs_extension/class_constants.h +8 -0
- data/ext/rbs_extension/extconf.rb +5 -1
- data/ext/rbs_extension/legacy_location.c +33 -56
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +44 -35
- data/include/rbs/ast.h +448 -173
- data/include/rbs/defines.h +27 -0
- data/include/rbs/lexer.h +30 -11
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +6 -6
- data/include/rbs/string.h +0 -2
- data/include/rbs/util/rbs_allocator.h +34 -13
- data/include/rbs/util/rbs_assert.h +12 -1
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs/util/rbs_encoding.h +2 -0
- data/include/rbs/util/rbs_unescape.h +2 -1
- data/include/rbs.h +8 -0
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +293 -3
- data/lib/rbs/ast/ruby/comment_block.rb +24 -0
- data/lib/rbs/ast/ruby/declarations.rb +198 -3
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +4 -0
- data/lib/rbs/ast/ruby/members.rb +532 -22
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +20 -15
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +38 -106
- data/lib/rbs/cli.rb +52 -19
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -2
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +62 -9
- data/lib/rbs/definition_builder/method_builder.rb +20 -0
- data/lib/rbs/definition_builder.rb +147 -25
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment.rb +227 -74
- data/lib/rbs/environment_loader.rb +0 -6
- data/lib/rbs/errors.rb +27 -18
- data/lib/rbs/inline_parser.rb +342 -6
- data/lib/rbs/location_aux.rb +1 -1
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/parser_aux.rb +20 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +8 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +116 -38
- data/lib/rbs/subtractor.rb +3 -1
- data/lib/rbs/test/type_check.rb +19 -2
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +88 -78
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +4 -3
- 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/schema/typeParam.json +17 -1
- data/sig/ast/ruby/annotations.rbs +315 -4
- data/sig/ast/ruby/comment_block.rbs +8 -0
- data/sig/ast/ruby/declarations.rbs +102 -4
- data/sig/ast/ruby/members.rbs +108 -2
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -1
- data/sig/definition_builder.rbs +2 -0
- data/sig/environment.rbs +70 -12
- data/sig/errors.rbs +13 -14
- data/sig/inline_parser.rbs +39 -2
- data/sig/locator.rbs +0 -2
- data/sig/manifest.yaml +0 -1
- data/sig/method_builder.rbs +3 -1
- data/sig/parser.rbs +31 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +35 -7
- data/sig/source.rbs +3 -3
- data/sig/type_param.rbs +13 -8
- data/sig/types.rbs +6 -7
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +410 -153
- data/src/lexer.c +1392 -1313
- data/src/lexer.re +3 -0
- data/src/lexstate.c +58 -37
- data/src/location.c +8 -48
- data/src/parser.c +977 -516
- data/src/string.c +0 -48
- data/src/util/rbs_allocator.c +89 -71
- data/src/util/rbs_assert.c +1 -1
- data/src/util/rbs_buffer.c +2 -2
- data/src/util/rbs_constant_pool.c +10 -14
- data/src/util/rbs_encoding.c +4 -8
- data/src/util/rbs_unescape.c +56 -20
- data/stdlib/bigdecimal/0/big_decimal.rbs +116 -98
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +7 -4
- data/stdlib/date/0/date.rbs +92 -79
- data/stdlib/date/0/date_time.rbs +25 -24
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +748 -347
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +158 -139
- data/stdlib/forwardable/0/forwardable.rbs +13 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +217 -136
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +162 -134
- data/stdlib/objspace/0/objspace.rbs +17 -34
- data/stdlib/open-uri/0/open-uri.rbs +48 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +475 -357
- data/stdlib/optparse/0/optparse.rbs +26 -17
- data/stdlib/pathname/0/pathname.rbs +11 -1381
- 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 +65 -12
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +2 -1
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/rdoc.rbs +1 -1
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +22 -19
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- 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 +23 -10
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +11 -3
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +1177 -85
- data/stdlib/strscan/0/string_scanner.rbs +27 -25
- data/stdlib/tempfile/0/tempfile.rbs +25 -21
- data/stdlib/time/0/time.rbs +8 -6
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +42 -20
- data/stdlib/uri/0/file.rbs +3 -3
- data/stdlib/uri/0/generic.rbs +26 -18
- 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 +12 -12
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +6 -6
- 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
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +50 -6
data/core/time.rbs
CHANGED
|
@@ -47,32 +47,38 @@
|
|
|
47
47
|
#
|
|
48
48
|
# ## Time Internal Representation
|
|
49
49
|
#
|
|
50
|
-
# Time
|
|
51
|
-
#
|
|
52
|
-
#
|
|
50
|
+
# Conceptually, Time class uses a rational value to represent the number of
|
|
51
|
+
# seconds from *Epoch*, 1970-01-01 00:00:00 UTC. There are no boundary or
|
|
52
|
+
# resolution limitations. The value can be obtained using Time#to_r.
|
|
53
|
+
#
|
|
54
|
+
# The Time class always uses the Gregorian calendar. I.e. the proleptic
|
|
55
|
+
# Gregorian calendar is used. Other calendars, such as Julian calendar, are not
|
|
56
|
+
# supported.
|
|
57
|
+
#
|
|
58
|
+
# The implementation uses a signed 63 bit integer, Integer (Bignum) object or
|
|
59
|
+
# Ratoinal object to represent a rational value. (The signed 63 bit integer is
|
|
60
|
+
# used regardless of 32 and 64 bit environments.) The value represents the
|
|
61
|
+
# number of nanoseconds from *Epoch*. The signed 63 bit integer can represent
|
|
62
|
+
# 1823-11-12 to 2116-02-20. When Integer or Rational object is used (before
|
|
53
63
|
# 1823, after 2116, under nanosecond), Time works slower than when the signed 63
|
|
54
64
|
# bit integer is used.
|
|
55
65
|
#
|
|
56
66
|
# Ruby uses the C function `localtime` and `gmtime` to map between the number
|
|
57
67
|
# and 6-tuple (year,month,day,hour,minute,second). `localtime` is used for local
|
|
58
|
-
# time and
|
|
68
|
+
# time and `gmtime` is used for UTC.
|
|
59
69
|
#
|
|
60
70
|
# Integer and Rational has no range limit, but the localtime and gmtime has
|
|
61
71
|
# range limits due to the C types `time_t` and `struct tm`. If that limit is
|
|
62
72
|
# exceeded, Ruby extrapolates the localtime function.
|
|
63
73
|
#
|
|
64
|
-
# The Time class always uses the Gregorian calendar. I.e. the proleptic
|
|
65
|
-
# Gregorian calendar is used. Other calendars, such as Julian calendar, are not
|
|
66
|
-
# supported.
|
|
67
|
-
#
|
|
68
74
|
# `time_t` can represent 1901-12-14 to 2038-01-19 if it is 32 bit signed
|
|
69
75
|
# integer, -292277022657-01-27 to 292277026596-12-05 if it is 64 bit signed
|
|
70
76
|
# integer. However `localtime` on some platforms doesn't supports negative
|
|
71
77
|
# `time_t` (before 1970).
|
|
72
78
|
#
|
|
73
|
-
# `struct tm` has *tm_year* member to represent years. (
|
|
74
|
-
# year 1900.) It is defined as `int` in the C standard. *tm_year* can
|
|
75
|
-
# 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.
|
|
76
82
|
#
|
|
77
83
|
# Ruby supports leap seconds as far as if the C function `localtime` and
|
|
78
84
|
# `gmtime` supports it. They use the tz database in most Unix systems. The tz
|
|
@@ -253,9 +259,9 @@
|
|
|
253
259
|
#
|
|
254
260
|
# Certain `Time` methods accept arguments that specify timezones:
|
|
255
261
|
#
|
|
256
|
-
# * Time.at: keyword argument
|
|
257
|
-
# * Time.new: positional argument `zone` or keyword argument
|
|
258
|
-
# * 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>.
|
|
259
265
|
# * Time#getlocal: positional argument `zone`.
|
|
260
266
|
# * Time#localtime: positional argument `zone`.
|
|
261
267
|
#
|
|
@@ -270,11 +276,11 @@
|
|
|
270
276
|
#
|
|
271
277
|
# ### Hours/Minutes Offsets
|
|
272
278
|
#
|
|
273
|
-
# The zone value may be a string offset from UTC in the form
|
|
274
|
-
#
|
|
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:
|
|
275
281
|
#
|
|
276
|
-
# * `HH` is the 2-digit hour in the range
|
|
277
|
-
# * `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>.
|
|
278
284
|
#
|
|
279
285
|
# Examples:
|
|
280
286
|
#
|
|
@@ -284,8 +290,8 @@
|
|
|
284
290
|
#
|
|
285
291
|
# ### Single-Letter Offsets
|
|
286
292
|
#
|
|
287
|
-
# The zone value may be a letter in the range
|
|
288
|
-
# [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
|
|
289
295
|
# zones](https://en.wikipedia.org/wiki/List_of_military_time_zones):
|
|
290
296
|
#
|
|
291
297
|
# t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
|
|
@@ -298,7 +304,7 @@
|
|
|
298
304
|
# ### Integer Offsets
|
|
299
305
|
#
|
|
300
306
|
# The zone value may be an integer number of seconds in the range
|
|
301
|
-
#
|
|
307
|
+
# <code>-86399..86399</code>:
|
|
302
308
|
#
|
|
303
309
|
# t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
|
|
304
310
|
# Time.at(t, in: -86399) # => 1999-12-31 20:15:02 -235959
|
|
@@ -315,7 +321,7 @@
|
|
|
315
321
|
# * `local_to_utc`:
|
|
316
322
|
#
|
|
317
323
|
# Called when Time.new is invoked with `tz` as the value of positional
|
|
318
|
-
# argument `zone` or keyword argument
|
|
324
|
+
# argument `zone` or keyword argument <code>in:</code>.
|
|
319
325
|
#
|
|
320
326
|
# Argument
|
|
321
327
|
# : a [Time-like object](rdoc-ref:Time@Time-Like+Objects).
|
|
@@ -328,8 +334,9 @@
|
|
|
328
334
|
# * `utc_to_local`:
|
|
329
335
|
#
|
|
330
336
|
# Called when Time.at or Time.now is invoked with `tz` as the value for
|
|
331
|
-
# keyword argument
|
|
332
|
-
# 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`.
|
|
333
340
|
#
|
|
334
341
|
# The UTC offset will be calculated as the difference between the original
|
|
335
342
|
# time and the returned object as an `Integer`. If the object is in fixed
|
|
@@ -348,7 +355,8 @@
|
|
|
348
355
|
#
|
|
349
356
|
# * `abbr`:
|
|
350
357
|
#
|
|
351
|
-
# 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>.
|
|
352
360
|
#
|
|
353
361
|
# Argument
|
|
354
362
|
# : a [Time-like object](rdoc-ref:Time@Time-Like+Objects).
|
|
@@ -357,11 +365,12 @@
|
|
|
357
365
|
# : a string abbreviation for the timezone name.
|
|
358
366
|
#
|
|
359
367
|
#
|
|
360
|
-
# *
|
|
368
|
+
# * <code>dst?</code>:
|
|
361
369
|
#
|
|
362
370
|
# Called when Time.at or Time.now is invoked with `tz` as the value for
|
|
363
|
-
# keyword argument
|
|
364
|
-
# 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`.
|
|
365
374
|
#
|
|
366
375
|
# Argument
|
|
367
376
|
# : a [Time-like object](rdoc-ref:Time@Time-Like+Objects).
|
|
@@ -372,7 +381,7 @@
|
|
|
372
381
|
#
|
|
373
382
|
# * `name`:
|
|
374
383
|
#
|
|
375
|
-
# Called when
|
|
384
|
+
# Called when <code>Marshal.dump(t)</code> is invoked
|
|
376
385
|
#
|
|
377
386
|
# Argument
|
|
378
387
|
# : none.
|
|
@@ -466,7 +475,7 @@ class Time < Object
|
|
|
466
475
|
# Required argument `time` may be either of:
|
|
467
476
|
#
|
|
468
477
|
# * A `Time` object, whose value is the basis for the returned time; also
|
|
469
|
-
# influenced by optional keyword argument
|
|
478
|
+
# influenced by optional keyword argument <code>in:</code> (see below).
|
|
470
479
|
# * A numeric number of [Epoch seconds](rdoc-ref:Time@Epoch+Seconds) for the
|
|
471
480
|
# returned time.
|
|
472
481
|
#
|
|
@@ -484,29 +493,29 @@ class Time < Object
|
|
|
484
493
|
# together to specify subseconds for the returned time; argument `units`
|
|
485
494
|
# specifies the units for `subsec`:
|
|
486
495
|
#
|
|
487
|
-
# *
|
|
496
|
+
# * <code>:millisecond</code>: `subsec` in milliseconds:
|
|
488
497
|
#
|
|
489
498
|
# Time.at(secs, 0, :millisecond) # => 2000-12-31 23:59:59 -0600
|
|
490
499
|
# Time.at(secs, 500, :millisecond) # => 2000-12-31 23:59:59.5 -0600
|
|
491
500
|
# Time.at(secs, 1000, :millisecond) # => 2001-01-01 00:00:00 -0600
|
|
492
501
|
# Time.at(secs, -1000, :millisecond) # => 2000-12-31 23:59:58 -0600
|
|
493
502
|
#
|
|
494
|
-
# *
|
|
503
|
+
# * <code>:microsecond</code> or <code>:usec</code>: `subsec` in microseconds:
|
|
495
504
|
#
|
|
496
505
|
# Time.at(secs, 0, :microsecond) # => 2000-12-31 23:59:59 -0600
|
|
497
506
|
# Time.at(secs, 500000, :microsecond) # => 2000-12-31 23:59:59.5 -0600
|
|
498
507
|
# Time.at(secs, 1000000, :microsecond) # => 2001-01-01 00:00:00 -0600
|
|
499
508
|
# Time.at(secs, -1000000, :microsecond) # => 2000-12-31 23:59:58 -0600
|
|
500
509
|
#
|
|
501
|
-
# *
|
|
510
|
+
# * <code>:nanosecond</code> or <code>:nsec</code>: `subsec` in nanoseconds:
|
|
502
511
|
#
|
|
503
512
|
# Time.at(secs, 0, :nanosecond) # => 2000-12-31 23:59:59 -0600
|
|
504
513
|
# Time.at(secs, 500000000, :nanosecond) # => 2000-12-31 23:59:59.5 -0600
|
|
505
514
|
# Time.at(secs, 1000000000, :nanosecond) # => 2001-01-01 00:00:00 -0600
|
|
506
515
|
# Time.at(secs, -1000000000, :nanosecond) # => 2000-12-31 23:59:58 -0600
|
|
507
516
|
#
|
|
508
|
-
# Optional keyword argument
|
|
509
|
-
# time:
|
|
517
|
+
# Optional keyword argument <code>in: zone</code> specifies the timezone for the
|
|
518
|
+
# returned time:
|
|
510
519
|
#
|
|
511
520
|
# Time.at(secs, in: '+12:00') # => 2001-01-01 17:59:59 +1200
|
|
512
521
|
# Time.at(secs, in: '-12:00') # => 2000-12-31 17:59:59 -1200
|
|
@@ -791,7 +800,7 @@ class Time < Object
|
|
|
791
800
|
# -->
|
|
792
801
|
# Compares `self` with `other_time`; returns:
|
|
793
802
|
#
|
|
794
|
-
# *
|
|
803
|
+
# * <code>-1</code>, if `self` is less than `other_time`.
|
|
795
804
|
# * `0`, if `self` is equal to `other_time`.
|
|
796
805
|
# * `1`, if `self` is greater then `other_time`.
|
|
797
806
|
# * `nil`, if `self` and `other_time` are incomparable.
|
|
@@ -819,9 +828,9 @@ class Time < Object
|
|
|
819
828
|
def >=: (Time arg0) -> bool
|
|
820
829
|
|
|
821
830
|
# <!-- rdoc-file=time.c -->
|
|
822
|
-
# Returns a string representation of `self`, formatted by
|
|
823
|
-
# %Y')
|
|
824
|
-
# 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):
|
|
825
834
|
#
|
|
826
835
|
# t = Time.new(2000, 12, 31, 23, 59, 59, 0.5)
|
|
827
836
|
# t.ctime # => "Sun Dec 31 23:59:59 2000"
|
|
@@ -839,9 +848,9 @@ class Time < Object
|
|
|
839
848
|
# rdoc-file=time.c
|
|
840
849
|
# - ctime -> string
|
|
841
850
|
# -->
|
|
842
|
-
# Returns a string representation of `self`, formatted by
|
|
843
|
-
# %Y')
|
|
844
|
-
# 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):
|
|
845
854
|
#
|
|
846
855
|
# t = Time.new(2000, 12, 31, 23, 59, 59, 0.5)
|
|
847
856
|
# t.ctime # => "Sun Dec 31 23:59:59 2000"
|
|
@@ -871,8 +880,10 @@ class Time < Object
|
|
|
871
880
|
# - deconstruct_keys(array_of_names_or_nil) -> hash
|
|
872
881
|
# -->
|
|
873
882
|
# Returns a hash of the name/value pairs, to use in pattern matching. Possible
|
|
874
|
-
# keys are:
|
|
875
|
-
#
|
|
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>.
|
|
876
887
|
#
|
|
877
888
|
# Possible usages:
|
|
878
889
|
#
|
|
@@ -984,10 +995,20 @@ class Time < Object
|
|
|
984
995
|
# now = Time.now
|
|
985
996
|
# # => 2022-08-18 10:24:13.5398485 -0500
|
|
986
997
|
# now.utc? # => false
|
|
998
|
+
# now.getutc.utc? # => true
|
|
987
999
|
# utc = Time.utc(2000, 1, 1, 20, 15, 1)
|
|
988
1000
|
# # => 2000-01-01 20:15:01 UTC
|
|
989
1001
|
# utc.utc? # => true
|
|
990
1002
|
#
|
|
1003
|
+
# `Time` objects created with these methods are considered to be in UTC:
|
|
1004
|
+
#
|
|
1005
|
+
# * Time.utc
|
|
1006
|
+
# * Time#utc
|
|
1007
|
+
# * Time#getutc
|
|
1008
|
+
#
|
|
1009
|
+
# Objects created in other ways will not be treated as UTC even if the
|
|
1010
|
+
# environment variable "TZ" is "UTC".
|
|
1011
|
+
#
|
|
991
1012
|
# Related: Time.utc.
|
|
992
1013
|
#
|
|
993
1014
|
def gmt?: () -> bool
|
|
@@ -1119,9 +1140,9 @@ class Time < Object
|
|
|
1119
1140
|
# # => ["0", "1", "1", "0", "0", "0"]
|
|
1120
1141
|
# Time.new(*a) # => 0000-01-01 00:00:00 -0600
|
|
1121
1142
|
#
|
|
1122
|
-
# When positional argument `zone` or keyword argument
|
|
1123
|
-
# `Time` object is in the specified timezone. For the forms of argument
|
|
1124
|
-
# 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):
|
|
1125
1146
|
#
|
|
1126
1147
|
# Time.new(2000, 1, 1, 0, 0, 0, '+12:00')
|
|
1127
1148
|
# # => 2000-01-01 00:00:00 +1200
|
|
@@ -1130,9 +1151,9 @@ class Time < Object
|
|
|
1130
1151
|
# Time.new(in: '-12:00')
|
|
1131
1152
|
# # => 2022-08-23 08:49:26.1941467 -1200
|
|
1132
1153
|
#
|
|
1133
|
-
# Since
|
|
1134
|
-
# argument in single string form contains time zone information, this
|
|
1135
|
-
# 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.
|
|
1136
1157
|
#
|
|
1137
1158
|
# Time.new('2000-01-01 00:00:00 +0100', in: '-0500').utc_offset # => 3600
|
|
1138
1159
|
#
|
|
@@ -1560,10 +1581,20 @@ class Time < Object
|
|
|
1560
1581
|
# now = Time.now
|
|
1561
1582
|
# # => 2022-08-18 10:24:13.5398485 -0500
|
|
1562
1583
|
# now.utc? # => false
|
|
1584
|
+
# now.getutc.utc? # => true
|
|
1563
1585
|
# utc = Time.utc(2000, 1, 1, 20, 15, 1)
|
|
1564
1586
|
# # => 2000-01-01 20:15:01 UTC
|
|
1565
1587
|
# utc.utc? # => true
|
|
1566
1588
|
#
|
|
1589
|
+
# `Time` objects created with these methods are considered to be in UTC:
|
|
1590
|
+
#
|
|
1591
|
+
# * Time.utc
|
|
1592
|
+
# * Time#utc
|
|
1593
|
+
# * Time#getutc
|
|
1594
|
+
#
|
|
1595
|
+
# Objects created in other ways will not be treated as UTC even if the
|
|
1596
|
+
# environment variable "TZ" is "UTC".
|
|
1597
|
+
#
|
|
1567
1598
|
# Related: Time.utc.
|
|
1568
1599
|
#
|
|
1569
1600
|
def utc?: () -> bool
|
data/core/trace_point.rbs
CHANGED
|
@@ -21,61 +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
|
-
# To filter what is traced, you can pass any of the following as
|
|
28
|
+
# To filter what is traced, you can pass any number of the following as
|
|
29
|
+
# `events`:
|
|
29
30
|
#
|
|
30
|
-
#
|
|
31
|
+
# <code>:line</code>
|
|
31
32
|
# : Execute an expression or statement on a new line.
|
|
32
33
|
#
|
|
33
|
-
#
|
|
34
|
+
# <code>:class</code>
|
|
34
35
|
# : Start a class or module definition.
|
|
35
36
|
#
|
|
36
|
-
#
|
|
37
|
+
# <code>:end</code>
|
|
37
38
|
# : Finish a class or module definition.
|
|
38
39
|
#
|
|
39
|
-
#
|
|
40
|
+
# <code>:call</code>
|
|
40
41
|
# : Call a Ruby method.
|
|
41
42
|
#
|
|
42
|
-
#
|
|
43
|
+
# <code>:return</code>
|
|
43
44
|
# : Return from a Ruby method.
|
|
44
45
|
#
|
|
45
|
-
#
|
|
46
|
+
# <code>:c_call</code>
|
|
46
47
|
# : Call a C-language routine.
|
|
47
48
|
#
|
|
48
|
-
#
|
|
49
|
+
# <code>:c_return</code>
|
|
49
50
|
# : Return from a C-language routine.
|
|
50
51
|
#
|
|
51
|
-
#
|
|
52
|
+
# <code>:raise</code>
|
|
52
53
|
# : Raise an exception.
|
|
53
54
|
#
|
|
54
|
-
#
|
|
55
|
+
# <code>:rescue</code>
|
|
55
56
|
# : Rescue an exception.
|
|
56
57
|
#
|
|
57
|
-
#
|
|
58
|
+
# <code>:b_call</code>
|
|
58
59
|
# : Event hook at block entry.
|
|
59
60
|
#
|
|
60
|
-
#
|
|
61
|
+
# <code>:b_return</code>
|
|
61
62
|
# : Event hook at block ending.
|
|
62
63
|
#
|
|
63
|
-
#
|
|
64
|
+
# <code>:a_call</code>
|
|
64
65
|
# : Event hook at all calls (`call`, `b_call`, and `c_call`).
|
|
65
66
|
#
|
|
66
|
-
#
|
|
67
|
+
# <code>:a_return</code>
|
|
67
68
|
# : Event hook at all returns (`return`, `b_return`, and `c_return`).
|
|
68
69
|
#
|
|
69
|
-
#
|
|
70
|
+
# <code>:thread_begin</code>
|
|
70
71
|
# : Event hook at thread beginning.
|
|
71
72
|
#
|
|
72
|
-
#
|
|
73
|
+
# <code>:thread_end</code>
|
|
73
74
|
# : Event hook at thread ending.
|
|
74
75
|
#
|
|
75
|
-
#
|
|
76
|
+
# <code>:fiber_switch</code>
|
|
76
77
|
# : Event hook at fiber switch.
|
|
77
78
|
#
|
|
78
|
-
#
|
|
79
|
+
# <code>:script_compiled</code>
|
|
79
80
|
# : New Ruby code compiled (with `eval`, `load`, or `require`).
|
|
80
81
|
#
|
|
81
82
|
class TracePoint
|
|
@@ -107,8 +108,8 @@ class TracePoint
|
|
|
107
108
|
#
|
|
108
109
|
# A block must be given; otherwise, an ArgumentError is raised.
|
|
109
110
|
#
|
|
110
|
-
# If the trace method isn't
|
|
111
|
-
# is raised.
|
|
111
|
+
# If the trace method isn't supported for the given event(s) filter, a
|
|
112
|
+
# RuntimeError is raised.
|
|
112
113
|
#
|
|
113
114
|
# TracePoint.trace(:line) do |tp|
|
|
114
115
|
# p tp.raised_exception
|
|
@@ -122,7 +123,9 @@ class TracePoint
|
|
|
122
123
|
# end
|
|
123
124
|
# $tp.lineno #=> access from outside (RuntimeError)
|
|
124
125
|
#
|
|
125
|
-
# Access from other threads is
|
|
126
|
+
# Access from other ractors, threads or fibers is forbidden. TracePoints are
|
|
127
|
+
# active per-ractor so if you enable a TracePoint in one ractor, other ractors
|
|
128
|
+
# will not be affected.
|
|
126
129
|
#
|
|
127
130
|
def self.new: (*_ToSym events) { (instance tp) -> void } -> instance
|
|
128
131
|
|
|
@@ -137,7 +140,7 @@ class TracePoint
|
|
|
137
140
|
#
|
|
138
141
|
# If called when reentrance is already allowed, it raises a RuntimeError.
|
|
139
142
|
#
|
|
140
|
-
#
|
|
143
|
+
# <strong>Example:</strong>
|
|
141
144
|
#
|
|
142
145
|
# # Without reentry
|
|
143
146
|
# # ---------------
|
|
@@ -220,8 +223,8 @@ class TracePoint
|
|
|
220
223
|
# -->
|
|
221
224
|
# Returns the generated binding object from the event.
|
|
222
225
|
#
|
|
223
|
-
# Note that for
|
|
224
|
-
# 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.
|
|
225
228
|
#
|
|
226
229
|
def binding: () -> Binding?
|
|
227
230
|
|
|
@@ -256,12 +259,13 @@ class TracePoint
|
|
|
256
259
|
# C.new.foo
|
|
257
260
|
# end
|
|
258
261
|
#
|
|
259
|
-
#
|
|
262
|
+
# <strong>Note:</strong> #defined_class returns the singleton class.
|
|
260
263
|
#
|
|
261
264
|
# The 6th block parameter of Kernel#set_trace_func passes the original class
|
|
262
265
|
# attached by the singleton class.
|
|
263
266
|
#
|
|
264
|
-
#
|
|
267
|
+
# <strong>This is a difference between Kernel#set_trace_func and
|
|
268
|
+
# TracePoint.</strong>
|
|
265
269
|
#
|
|
266
270
|
# class C; def self.foo; end; end
|
|
267
271
|
# trace = TracePoint.new(:call) do |tp|
|
|
@@ -429,8 +433,8 @@ class TracePoint
|
|
|
429
433
|
# rdoc-file=trace_point.rb
|
|
430
434
|
# - raised_exception()
|
|
431
435
|
# -->
|
|
432
|
-
# Returns the exception raised on the
|
|
433
|
-
# event.
|
|
436
|
+
# Returns the exception raised on the <code>:raise</code> event or rescued on
|
|
437
|
+
# the <code>:rescue</code> event.
|
|
434
438
|
#
|
|
435
439
|
def raised_exception: () -> Exception
|
|
436
440
|
|
|
@@ -438,7 +442,8 @@ class TracePoint
|
|
|
438
442
|
# rdoc-file=trace_point.rb
|
|
439
443
|
# - return_value()
|
|
440
444
|
# -->
|
|
441
|
-
# 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.
|
|
442
447
|
#
|
|
443
448
|
def return_value: () -> untyped
|
|
444
449
|
|
|
@@ -449,7 +454,7 @@ class TracePoint
|
|
|
449
454
|
# Returns the trace object during the event.
|
|
450
455
|
#
|
|
451
456
|
# Similar to the following, but it returns the correct object (the method
|
|
452
|
-
# receiver) for
|
|
457
|
+
# receiver) for <code>:c_call</code> and <code>:c_return</code> events:
|
|
453
458
|
#
|
|
454
459
|
# trace.binding.eval('self')
|
|
455
460
|
#
|
|
@@ -460,7 +465,7 @@ class TracePoint
|
|
|
460
465
|
# - eval_script()
|
|
461
466
|
# -->
|
|
462
467
|
# Returns the compiled source code (String) from eval methods on the
|
|
463
|
-
#
|
|
468
|
+
# <code>:script_compiled</code> event. If loaded from a file, it returns `nil`.
|
|
464
469
|
#
|
|
465
470
|
def eval_script: () -> String?
|
|
466
471
|
|
|
@@ -469,7 +474,8 @@ class TracePoint
|
|
|
469
474
|
# - instruction_sequence()
|
|
470
475
|
# -->
|
|
471
476
|
# Returns the compiled instruction sequence represented by a
|
|
472
|
-
# RubyVM::InstructionSequence instance on the
|
|
477
|
+
# RubyVM::InstructionSequence instance on the <code>:script_compiled</code>
|
|
478
|
+
# event.
|
|
473
479
|
#
|
|
474
480
|
# Note that this method is CRuby-specific.
|
|
475
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# <!-- rdoc-file=proc.c -->
|
|
2
|
-
# Ruby supports two forms of objectified methods. Class Method is used to
|
|
2
|
+
# Ruby supports two forms of objectified methods. Class `Method` is used to
|
|
3
3
|
# represent methods that are associated with a particular object: these method
|
|
4
4
|
# objects are bound to that object. Bound method objects for an object can be
|
|
5
5
|
# created using Object#method.
|
|
@@ -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#+(_)>""
|
|
@@ -287,10 +287,18 @@ class UnboundMethod
|
|
|
287
287
|
|
|
288
288
|
# <!--
|
|
289
289
|
# rdoc-file=proc.c
|
|
290
|
-
# - meth.source_location -> [String, Integer]
|
|
290
|
+
# - meth.source_location -> [String, Integer, Integer, Integer, Integer]
|
|
291
291
|
# -->
|
|
292
|
-
# Returns the
|
|
293
|
-
#
|
|
292
|
+
# Returns the location where the method was defined. The returned Array
|
|
293
|
+
# contains:
|
|
294
|
+
# (1) the Ruby source filename
|
|
295
|
+
# (2) the line number where the definition starts
|
|
296
|
+
# (3) the column number where the definition starts
|
|
297
|
+
# (4) the line number where the definition ends
|
|
298
|
+
# (5) the column number where the definitions ends
|
|
299
|
+
#
|
|
300
|
+
# This method will return `nil` if the method was not defined in Ruby (i.e.
|
|
301
|
+
# native).
|
|
294
302
|
#
|
|
295
303
|
def source_location: () -> [String, Integer]?
|
|
296
304
|
|
|
@@ -298,8 +306,8 @@ class UnboundMethod
|
|
|
298
306
|
# rdoc-file=proc.c
|
|
299
307
|
# - meth.super_method -> method
|
|
300
308
|
# -->
|
|
301
|
-
# Returns a Method of superclass which would be called when super is used or
|
|
302
|
-
# if there is no method on superclass.
|
|
309
|
+
# Returns a `Method` of superclass which would be called when super is used or
|
|
310
|
+
# nil if there is no method on superclass.
|
|
303
311
|
#
|
|
304
312
|
def super_method: () -> UnboundMethod?
|
|
305
313
|
|
|
@@ -322,8 +330,8 @@ class UnboundMethod
|
|
|
322
330
|
# - umeth.bind_call(recv, args, ...) -> obj
|
|
323
331
|
# -->
|
|
324
332
|
# Bind *umeth* to *recv* and then invokes the method with the specified
|
|
325
|
-
# arguments. This is semantically equivalent to
|
|
326
|
-
# ...)
|
|
333
|
+
# arguments. This is semantically equivalent to
|
|
334
|
+
# <code>umeth.bind(recv).call(args, ...)</code>.
|
|
327
335
|
#
|
|
328
336
|
def bind_call: (untyped recv, *untyped, **untyped) ?{ (?) -> untyped } -> untyped
|
|
329
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
|
#
|