rbs 4.0.0.dev.4 → 4.0.0.dev.5
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 +11 -8
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +17 -34
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/valgrind.yml +42 -0
- data/.github/workflows/windows.yml +2 -2
- data/.rubocop.yml +1 -1
- data/README.md +1 -1
- data/Rakefile +32 -5
- data/config.yml +46 -0
- data/core/array.rbs +96 -46
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/comparable.rbs +13 -6
- data/core/complex.rbs +55 -41
- data/core/dir.rbs +4 -4
- data/core/encoding.rbs +7 -10
- data/core/enumerable.rbs +90 -3
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +63 -1
- data/core/errno.rbs +8 -0
- data/core/errors.rbs +28 -1
- data/core/exception.rbs +2 -2
- data/core/fiber.rbs +40 -20
- data/core/file.rbs +108 -78
- data/core/file_test.rbs +1 -1
- data/core/float.rbs +225 -69
- data/core/gc.rbs +417 -281
- data/core/hash.rbs +1023 -727
- data/core/integer.rbs +104 -110
- data/core/io/buffer.rbs +21 -10
- data/core/io/wait.rbs +11 -33
- data/core/io.rbs +82 -19
- data/core/kernel.rbs +70 -59
- data/core/marshal.rbs +1 -1
- data/core/match_data.rbs +1 -1
- data/core/math.rbs +42 -3
- data/core/method.rbs +63 -27
- data/core/module.rbs +103 -26
- data/core/nil_class.rbs +3 -3
- data/core/numeric.rbs +43 -35
- data/core/object.rbs +3 -3
- data/core/object_space.rbs +21 -15
- data/core/pathname.rbs +1272 -0
- data/core/proc.rbs +30 -25
- data/core/process.rbs +4 -2
- data/core/ractor.rbs +361 -509
- data/core/random.rbs +17 -0
- data/core/range.rbs +113 -16
- data/core/rational.rbs +56 -85
- data/core/rbs/unnamed/argf.rbs +2 -2
- data/core/rbs/unnamed/env_class.rbs +1 -1
- data/core/rbs/unnamed/random.rbs +4 -113
- data/core/regexp.rbs +25 -20
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +6 -4
- data/core/rubygems/errors.rbs +3 -70
- data/core/rubygems/rubygems.rbs +11 -79
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +488 -359
- data/core/signal.rbs +24 -14
- data/core/string.rbs +3171 -1241
- data/core/struct.rbs +1 -1
- data/core/symbol.rbs +17 -11
- data/core/thread.rbs +95 -33
- data/core/time.rbs +35 -9
- data/core/trace_point.rbs +7 -4
- data/core/unbound_method.rbs +14 -6
- data/docs/aliases.md +79 -0
- data/docs/collection.md +2 -2
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +470 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +33 -4
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +77 -3
- data/ext/rbs_extension/ast_translation.h +3 -0
- data/ext/rbs_extension/class_constants.c +8 -2
- data/ext/rbs_extension/class_constants.h +4 -0
- data/ext/rbs_extension/extconf.rb +5 -1
- data/ext/rbs_extension/legacy_location.c +5 -5
- data/ext/rbs_extension/main.c +37 -20
- data/include/rbs/ast.h +85 -38
- data/include/rbs/defines.h +27 -0
- data/include/rbs/lexer.h +30 -11
- 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_encoding.h +2 -0
- data/include/rbs/util/rbs_unescape.h +2 -1
- 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 +137 -0
- 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 +159 -1
- 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 -51
- data/lib/rbs/cli.rb +52 -19
- data/lib/rbs/collection/config/lockfile_generator.rb +8 -0
- 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 +91 -2
- 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 -7
- data/lib/rbs/inline_parser.rb +341 -5
- 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 +2 -2
- data/lib/rbs/prototype/rb.rb +2 -2
- data/lib/rbs/prototype/rbi.rb +2 -0
- 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 +16 -2
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +27 -27
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +3 -2
- data/schema/typeParam.json +17 -1
- data/sig/ast/ruby/annotations.rbs +124 -0
- data/sig/ast/ruby/comment_block.rbs +8 -0
- data/sig/ast/ruby/declarations.rbs +102 -4
- data/sig/ast/ruby/members.rbs +87 -1
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +13 -4
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -1
- data/sig/environment.rbs +70 -12
- data/sig/errors.rbs +13 -6
- 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/method_types.rbs +1 -1
- data/sig/parser.rbs +16 -2
- 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 +4 -4
- data/src/ast.c +80 -1
- data/src/lexer.c +1392 -1313
- data/src/lexer.re +3 -0
- data/src/lexstate.c +58 -37
- data/src/location.c +4 -4
- data/src/parser.c +412 -145
- 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 -10
- data/src/util/rbs_encoding.c +4 -8
- data/src/util/rbs_unescape.c +56 -20
- data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
- 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 +3 -1
- data/stdlib/date/0/date.rbs +67 -59
- data/stdlib/date/0/date_time.rbs +1 -1
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +737 -347
- data/stdlib/fileutils/0/fileutils.rbs +20 -14
- data/stdlib/forwardable/0/forwardable.rbs +3 -0
- data/stdlib/json/0/json.rbs +82 -28
- data/stdlib/net-http/0/net-http.rbs +3 -0
- data/stdlib/objspace/0/objspace.rbs +9 -27
- data/stdlib/open-uri/0/open-uri.rbs +40 -0
- data/stdlib/open3/0/open3.rbs +459 -1
- data/stdlib/openssl/0/openssl.rbs +331 -228
- data/stdlib/optparse/0/optparse.rbs +8 -3
- data/stdlib/pathname/0/pathname.rbs +9 -1379
- data/stdlib/psych/0/psych.rbs +4 -4
- 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 +2 -2
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +6 -19
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/socket.rbs +13 -1
- data/stdlib/socket/0/tcp_socket.rbs +10 -2
- data/stdlib/stringio/0/stringio.rbs +1176 -85
- data/stdlib/strscan/0/string_scanner.rbs +31 -31
- data/stdlib/tempfile/0/tempfile.rbs +3 -3
- data/stdlib/time/0/time.rbs +1 -1
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/uri/0/common.rbs +16 -2
- data/stdlib/uri/0/file.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +24 -16
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
- data/stdlib/zlib/0/gzip_reader.rbs +2 -2
- data/stdlib/zlib/0/gzip_writer.rbs +1 -1
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +30 -4
data/core/io.rbs
CHANGED
|
@@ -1373,7 +1373,7 @@ class IO < Object
|
|
|
1373
1373
|
# Formats and writes `objects` to the stream.
|
|
1374
1374
|
#
|
|
1375
1375
|
# For details on `format_string`, see [Format
|
|
1376
|
-
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
1376
|
+
# Specifications](rdoc-ref:language/format_specifications.rdoc).
|
|
1377
1377
|
#
|
|
1378
1378
|
def printf: (String format_string, *untyped objects) -> nil
|
|
1379
1379
|
|
|
@@ -1443,6 +1443,61 @@ class IO < Object
|
|
|
1443
1443
|
#
|
|
1444
1444
|
def puts: (*untyped objects) -> nil
|
|
1445
1445
|
|
|
1446
|
+
# <!--
|
|
1447
|
+
# rdoc-file=io.c
|
|
1448
|
+
# - pread(maxlen, offset) -> string
|
|
1449
|
+
# - pread(maxlen, offset, out_string) -> string
|
|
1450
|
+
# -->
|
|
1451
|
+
# Behaves like IO#readpartial, except that it:
|
|
1452
|
+
#
|
|
1453
|
+
# * Reads at the given `offset` (in bytes).
|
|
1454
|
+
# * Disregards, and does not modify, the stream's position (see
|
|
1455
|
+
# [Position](rdoc-ref:IO@Position)).
|
|
1456
|
+
# * Bypasses any user space buffering in the stream.
|
|
1457
|
+
#
|
|
1458
|
+
# Because this method does not disturb the stream's state (its position, in
|
|
1459
|
+
# particular), `pread` allows multiple threads and processes to use the same IO
|
|
1460
|
+
# object for reading at various offsets.
|
|
1461
|
+
#
|
|
1462
|
+
# f = File.open('t.txt')
|
|
1463
|
+
# f.read # => "First line\nSecond line\n\nFourth line\nFifth line\n"
|
|
1464
|
+
# f.pos # => 52
|
|
1465
|
+
# # Read 12 bytes at offset 0.
|
|
1466
|
+
# f.pread(12, 0) # => "First line\n"
|
|
1467
|
+
# # Read 9 bytes at offset 8.
|
|
1468
|
+
# f.pread(9, 8) # => "ne\nSecon"
|
|
1469
|
+
# f.close
|
|
1470
|
+
#
|
|
1471
|
+
# Not available on some platforms.
|
|
1472
|
+
#
|
|
1473
|
+
def pread: (int maxlen, int offset, ?string out_string) -> String
|
|
1474
|
+
|
|
1475
|
+
# <!--
|
|
1476
|
+
# rdoc-file=io.c
|
|
1477
|
+
# - pwrite(object, offset) -> integer
|
|
1478
|
+
# -->
|
|
1479
|
+
# Behaves like IO#write, except that it:
|
|
1480
|
+
#
|
|
1481
|
+
# * Writes at the given `offset` (in bytes).
|
|
1482
|
+
# * Disregards, and does not modify, the stream's position (see
|
|
1483
|
+
# [Position](rdoc-ref:IO@Position)).
|
|
1484
|
+
# * Bypasses any user space buffering in the stream.
|
|
1485
|
+
#
|
|
1486
|
+
# Because this method does not disturb the stream's state (its position, in
|
|
1487
|
+
# particular), `pwrite` allows multiple threads and processes to use the same IO
|
|
1488
|
+
# object for writing at various offsets.
|
|
1489
|
+
#
|
|
1490
|
+
# f = File.open('t.tmp', 'w+')
|
|
1491
|
+
# # Write 6 bytes at offset 3.
|
|
1492
|
+
# f.pwrite('ABCDEF', 3) # => 6
|
|
1493
|
+
# f.rewind
|
|
1494
|
+
# f.read # => "\u0000\u0000\u0000ABCDEF"
|
|
1495
|
+
# f.close
|
|
1496
|
+
#
|
|
1497
|
+
# Not available on some platforms.
|
|
1498
|
+
#
|
|
1499
|
+
def pwrite: (_ToS object, int offset) -> Integer
|
|
1500
|
+
|
|
1446
1501
|
# <!--
|
|
1447
1502
|
# rdoc-file=io.c
|
|
1448
1503
|
# - read(maxlen = nil, out_string = nil) -> new_string, out_string, or nil
|
|
@@ -2276,7 +2331,7 @@ class IO < Object
|
|
|
2276
2331
|
#
|
|
2277
2332
|
# When called from class IO (but not subclasses of IO), this method has
|
|
2278
2333
|
# potential security vulnerabilities if called with untrusted input; see
|
|
2279
|
-
# [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2334
|
+
# [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2280
2335
|
#
|
|
2281
2336
|
def self.binread: (path name, ?Integer? length, ?Integer offset) -> String
|
|
2282
2337
|
|
|
@@ -2289,7 +2344,7 @@ class IO < Object
|
|
|
2289
2344
|
#
|
|
2290
2345
|
# When called from class IO (but not subclasses of IO), this method has
|
|
2291
2346
|
# potential security vulnerabilities if called with untrusted input; see
|
|
2292
|
-
# [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2347
|
+
# [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2293
2348
|
#
|
|
2294
2349
|
def self.binwrite: (path name, _ToS string, ?Integer offset, ?mode: String mode) -> Integer
|
|
2295
2350
|
|
|
@@ -2354,15 +2409,16 @@ class IO < Object
|
|
|
2354
2409
|
# connected to a new stream `io`.
|
|
2355
2410
|
#
|
|
2356
2411
|
# This method has potential security vulnerabilities if called with untrusted
|
|
2357
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2412
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2358
2413
|
#
|
|
2359
2414
|
# If no block is given, returns the new stream, which depending on given `mode`
|
|
2360
2415
|
# may be open for reading, writing, or both. The stream should be explicitly
|
|
2361
2416
|
# closed (eventually) to avoid resource leaks.
|
|
2362
2417
|
#
|
|
2363
2418
|
# If a block is given, the stream is passed to the block (again, open for
|
|
2364
|
-
# reading, writing, or both); when the block exits, the stream is closed,
|
|
2365
|
-
#
|
|
2419
|
+
# reading, writing, or both); when the block exits, the stream is closed, the
|
|
2420
|
+
# block's value is returned, and the global variable `$?` is set to the child's
|
|
2421
|
+
# exit status.
|
|
2366
2422
|
#
|
|
2367
2423
|
# Optional argument `mode` may be any valid IO mode. See [Access
|
|
2368
2424
|
# Modes](rdoc-ref:File@Access+Modes).
|
|
@@ -2391,7 +2447,7 @@ class IO < Object
|
|
|
2391
2447
|
# * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
|
|
2392
2448
|
# * Options for Kernel#spawn.
|
|
2393
2449
|
#
|
|
2394
|
-
# **Forked
|
|
2450
|
+
# **Forked Process**
|
|
2395
2451
|
#
|
|
2396
2452
|
# When argument `cmd` is the 1-character string `'-'`, causes the process to
|
|
2397
2453
|
# fork:
|
|
@@ -2503,10 +2559,10 @@ class IO < Object
|
|
|
2503
2559
|
#
|
|
2504
2560
|
# Raises exceptions that IO.pipe and Kernel.spawn raise.
|
|
2505
2561
|
#
|
|
2506
|
-
def self.popen: (string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others:
|
|
2507
|
-
| (Hash[string, string?] env, string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others:
|
|
2508
|
-
| [X] (string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others:
|
|
2509
|
-
| [X] (Hash[string, string?] env, string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others:
|
|
2562
|
+
def self.popen: (string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: bool, ?chdir: String) -> instance
|
|
2563
|
+
| (Hash[string, string?] env, string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: bool, ?chdir: String) -> instance
|
|
2564
|
+
| [X] (string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: bool, ?chdir: String) { (instance) -> X } -> X
|
|
2565
|
+
| [X] (Hash[string, string?] env, string | cmd_array cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: bool, ?chdir: String) { (instance) -> X } -> X
|
|
2510
2566
|
|
|
2511
2567
|
# The command can be given as:
|
|
2512
2568
|
#
|
|
@@ -2528,7 +2584,7 @@ class IO < Object
|
|
|
2528
2584
|
#
|
|
2529
2585
|
# When called from class IO (but not subclasses of IO), this method has
|
|
2530
2586
|
# potential security vulnerabilities if called with untrusted input; see
|
|
2531
|
-
# [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2587
|
+
# [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2532
2588
|
#
|
|
2533
2589
|
# The first argument must be a string that is the path to a file.
|
|
2534
2590
|
#
|
|
@@ -2594,8 +2650,8 @@ class IO < Object
|
|
|
2594
2650
|
#
|
|
2595
2651
|
# Returns an Enumerator if no block is given.
|
|
2596
2652
|
#
|
|
2597
|
-
def self.foreach: (
|
|
2598
|
-
| (
|
|
2653
|
+
def self.foreach: (path path, ?String sep, ?Integer limit, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) { (String line) -> void } -> nil
|
|
2654
|
+
| (path path, ?String sep, ?Integer limit, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) -> ::Enumerator[String, nil]
|
|
2599
2655
|
|
|
2600
2656
|
# <!--
|
|
2601
2657
|
# rdoc-file=io.c
|
|
@@ -2685,7 +2741,7 @@ class IO < Object
|
|
|
2685
2741
|
#
|
|
2686
2742
|
# When called from class IO (but not subclasses of IO), this method has
|
|
2687
2743
|
# potential security vulnerabilities if called with untrusted input; see
|
|
2688
|
-
# [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2744
|
+
# [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2689
2745
|
#
|
|
2690
2746
|
# The first argument must be a string that is the path to a file.
|
|
2691
2747
|
#
|
|
@@ -2728,7 +2784,7 @@ class IO < Object
|
|
|
2728
2784
|
#
|
|
2729
2785
|
# When called from class IO (but not subclasses of IO), this method has
|
|
2730
2786
|
# potential security vulnerabilities if called with untrusted input; see
|
|
2731
|
-
# [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2787
|
+
# [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2732
2788
|
#
|
|
2733
2789
|
# The first argument must be a string that is the path to a file.
|
|
2734
2790
|
#
|
|
@@ -2769,7 +2825,7 @@ class IO < Object
|
|
|
2769
2825
|
# * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
|
|
2770
2826
|
# * [Line Options](rdoc-ref:IO@Line+IO).
|
|
2771
2827
|
#
|
|
2772
|
-
def self.readlines: (
|
|
2828
|
+
def self.readlines: (path name, ?String sep, ?Integer limit, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) -> ::Array[String]
|
|
2773
2829
|
|
|
2774
2830
|
# <!--
|
|
2775
2831
|
# rdoc-file=io.c
|
|
@@ -2785,7 +2841,8 @@ class IO < Object
|
|
|
2785
2841
|
# IO objects.
|
|
2786
2842
|
#
|
|
2787
2843
|
# Argument `timeout` is a numeric value (such as integer or float) timeout
|
|
2788
|
-
# interval in seconds.
|
|
2844
|
+
# interval in seconds. `timeout` can also be `nil` or `Float::INFINITY`. `nil`
|
|
2845
|
+
# and `Float::INFINITY` means no timeout.
|
|
2789
2846
|
#
|
|
2790
2847
|
# The method monitors the IO objects given in all three arrays, waiting for some
|
|
2791
2848
|
# to be ready; returns a 3-element array whose elements are:
|
|
@@ -2952,7 +3009,7 @@ class IO < Object
|
|
|
2952
3009
|
#
|
|
2953
3010
|
# When called from class IO (but not subclasses of IO), this method has
|
|
2954
3011
|
# potential security vulnerabilities if called with untrusted input; see
|
|
2955
|
-
# [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
3012
|
+
# [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2956
3013
|
#
|
|
2957
3014
|
# The first argument must be a string that is the path to a file.
|
|
2958
3015
|
#
|
|
@@ -3404,3 +3461,9 @@ end
|
|
|
3404
3461
|
#
|
|
3405
3462
|
module IO::WaitWritable
|
|
3406
3463
|
end
|
|
3464
|
+
|
|
3465
|
+
# <!-- rdoc-file=io.c -->
|
|
3466
|
+
# Can be raised by IO operations when IO#timeout= is set.
|
|
3467
|
+
#
|
|
3468
|
+
class IO::TimeoutError < IOError
|
|
3469
|
+
end
|
data/core/kernel.rbs
CHANGED
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
# * #print: Prints the given objects to standard output without a newline.
|
|
81
81
|
# * #printf: Prints the string resulting from applying the given format string
|
|
82
82
|
# to any additional arguments.
|
|
83
|
-
# * #putc: Equivalent to
|
|
83
|
+
# * #putc: Equivalent to `$stdout.putc(object)` for the given object.
|
|
84
84
|
# * #puts: Equivalent to `$stdout.puts(*objects)` for the given objects.
|
|
85
85
|
# * #readline: Similar to #gets, but raises an exception at the end of file.
|
|
86
86
|
# * #readlines: Returns an array of the remaining lines from the current
|
|
@@ -204,8 +204,9 @@ module Kernel : BasicObject
|
|
|
204
204
|
# Optionally you can pass a range, which will return an array containing the
|
|
205
205
|
# entries within the specified range.
|
|
206
206
|
#
|
|
207
|
-
def self?.caller_locations: (
|
|
208
|
-
| (
|
|
207
|
+
def self?.caller_locations: (Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
|
|
208
|
+
| (::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
|
|
209
|
+
| () -> ::Array[Thread::Backtrace::Location]
|
|
209
210
|
|
|
210
211
|
# <!--
|
|
211
212
|
# rdoc-file=vm_eval.c
|
|
@@ -718,14 +719,14 @@ module Kernel : BasicObject
|
|
|
718
719
|
# variable `$?` to the process status.
|
|
719
720
|
#
|
|
720
721
|
# This method has potential security vulnerabilities if called with untrusted
|
|
721
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
722
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
722
723
|
#
|
|
723
724
|
# Examples:
|
|
724
725
|
#
|
|
725
726
|
# $ `date` # => "Wed Apr 9 08:56:30 CDT 2003\n"
|
|
726
727
|
# $ `echo oops && exit 99` # => "oops\n"
|
|
727
728
|
# $ $? # => #<Process::Status: pid 17088 exit 99>
|
|
728
|
-
# $ $?.
|
|
729
|
+
# $ $?.exitstatus # => 99
|
|
729
730
|
#
|
|
730
731
|
# The built-in syntax `%x{...}` uses this method.
|
|
731
732
|
#
|
|
@@ -777,6 +778,8 @@ module Kernel : BasicObject
|
|
|
777
778
|
# If *const* is defined as autoload, the file name to be loaded is replaced with
|
|
778
779
|
# *filename*. If *const* is defined but not as autoload, does nothing.
|
|
779
780
|
#
|
|
781
|
+
# Files that are currently being loaded must not be registered for autoload.
|
|
782
|
+
#
|
|
780
783
|
def self?.autoload: (interned _module, String filename) -> NilClass
|
|
781
784
|
|
|
782
785
|
# <!--
|
|
@@ -1002,6 +1005,8 @@ module Kernel : BasicObject
|
|
|
1002
1005
|
# With argument `exception` not given, argument `message` and keyword argument
|
|
1003
1006
|
# `cause` may be given, but argument `backtrace` may not be given.
|
|
1004
1007
|
#
|
|
1008
|
+
# `cause` can not be given as an only argument.
|
|
1009
|
+
#
|
|
1005
1010
|
def self?.fail: () -> bot
|
|
1006
1011
|
| (string message, ?cause: Exception?) -> bot
|
|
1007
1012
|
| (_Exception exception, ?_ToS? message, ?String | Array[String] | Array[Thread::Backtrace::Location] | nil backtrace, ?cause: Exception?) -> bot
|
|
@@ -1108,6 +1113,8 @@ module Kernel : BasicObject
|
|
|
1108
1113
|
# With argument `exception` not given, argument `message` and keyword argument
|
|
1109
1114
|
# `cause` may be given, but argument `backtrace` may not be given.
|
|
1110
1115
|
#
|
|
1116
|
+
# `cause` can not be given as an only argument.
|
|
1117
|
+
#
|
|
1111
1118
|
alias raise fail
|
|
1112
1119
|
|
|
1113
1120
|
alias self.raise self.fail
|
|
@@ -1116,7 +1123,7 @@ module Kernel : BasicObject
|
|
|
1116
1123
|
# Returns the string resulting from formatting `objects` into `format_string`.
|
|
1117
1124
|
#
|
|
1118
1125
|
# For details on `format_string`, see [Format
|
|
1119
|
-
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
1126
|
+
# Specifications](rdoc-ref:language/format_specifications.rdoc).
|
|
1120
1127
|
#
|
|
1121
1128
|
def self?.format: (String format, *untyped args) -> String
|
|
1122
1129
|
|
|
@@ -1127,7 +1134,7 @@ module Kernel : BasicObject
|
|
|
1127
1134
|
# Returns the string resulting from formatting `objects` into `format_string`.
|
|
1128
1135
|
#
|
|
1129
1136
|
# For details on `format_string`, see [Format
|
|
1130
|
-
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
1137
|
+
# Specifications](rdoc-ref:language/format_specifications.rdoc).
|
|
1131
1138
|
#
|
|
1132
1139
|
alias sprintf format
|
|
1133
1140
|
|
|
@@ -1218,6 +1225,7 @@ module Kernel : BasicObject
|
|
|
1218
1225
|
# loop do
|
|
1219
1226
|
# print "Input: "
|
|
1220
1227
|
# line = gets
|
|
1228
|
+
# # break if q, Q is entered or EOF signal (Ctrl-D on Unix, Ctrl-Z on windows) is sent
|
|
1221
1229
|
# break if !line or line =~ /^q/i
|
|
1222
1230
|
# # ...
|
|
1223
1231
|
# end
|
|
@@ -1246,7 +1254,7 @@ module Kernel : BasicObject
|
|
|
1246
1254
|
# Creates an IO object connected to the given file.
|
|
1247
1255
|
#
|
|
1248
1256
|
# This method has potential security vulnerabilities if called with untrusted
|
|
1249
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
1257
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
1250
1258
|
#
|
|
1251
1259
|
# With no block given, file stream is returned:
|
|
1252
1260
|
#
|
|
@@ -1324,7 +1332,7 @@ module Kernel : BasicObject
|
|
|
1324
1332
|
# io.write(sprintf(format_string, *objects))
|
|
1325
1333
|
#
|
|
1326
1334
|
# For details on `format_string`, see [Format
|
|
1327
|
-
# Specifications](rdoc-ref:format_specifications.rdoc).
|
|
1335
|
+
# Specifications](rdoc-ref:language/format_specifications.rdoc).
|
|
1328
1336
|
#
|
|
1329
1337
|
# With the single argument `format_string`, formats `objects` into the string,
|
|
1330
1338
|
# then writes the formatted string to $stdout:
|
|
@@ -1463,7 +1471,9 @@ module Kernel : BasicObject
|
|
|
1463
1471
|
# Kernel.srand may be used to ensure that sequences of random numbers are
|
|
1464
1472
|
# reproducible between different runs of a program.
|
|
1465
1473
|
#
|
|
1466
|
-
#
|
|
1474
|
+
# Related: Random.rand.
|
|
1475
|
+
# rand(100.0) # => 64 (Integer because max.to_i is 100)
|
|
1476
|
+
# Random.rand(100.0) # => 30.315320967824523
|
|
1467
1477
|
#
|
|
1468
1478
|
def self?.rand: (?0) -> Float
|
|
1469
1479
|
| (int arg0) -> Integer
|
|
@@ -1585,7 +1595,8 @@ module Kernel : BasicObject
|
|
|
1585
1595
|
# IO objects.
|
|
1586
1596
|
#
|
|
1587
1597
|
# Argument `timeout` is a numeric value (such as integer or float) timeout
|
|
1588
|
-
# interval in seconds.
|
|
1598
|
+
# interval in seconds. `timeout` can also be `nil` or `Float::INFINITY`. `nil`
|
|
1599
|
+
# and `Float::INFINITY` means no timeout.
|
|
1589
1600
|
#
|
|
1590
1601
|
# The method monitors the IO objects given in all three arrays, waiting for some
|
|
1591
1602
|
# to be ready; returns a 3-element array whose elements are:
|
|
@@ -1773,58 +1784,58 @@ module Kernel : BasicObject
|
|
|
1773
1784
|
# * Each of these tests operates only on the entity at `path0`,
|
|
1774
1785
|
# and returns `true` or `false`;
|
|
1775
1786
|
# for a non-existent entity, returns `false` (does not raise exception):
|
|
1776
|
-
#
|
|
1777
|
-
#
|
|
1778
|
-
#
|
|
1779
|
-
#
|
|
1780
|
-
#
|
|
1781
|
-
#
|
|
1782
|
-
#
|
|
1783
|
-
#
|
|
1784
|
-
#
|
|
1785
|
-
#
|
|
1786
|
-
#
|
|
1787
|
-
#
|
|
1788
|
-
#
|
|
1789
|
-
#
|
|
1790
|
-
#
|
|
1791
|
-
#
|
|
1792
|
-
#
|
|
1793
|
-
#
|
|
1794
|
-
#
|
|
1795
|
-
#
|
|
1796
|
-
#
|
|
1797
|
-
#
|
|
1798
|
-
#
|
|
1787
|
+
# Character|Test
|
|
1788
|
+
# ---------|-------------------------------------------------------------------
|
|
1789
|
+
# `'b'` |Whether the entity is a block device.
|
|
1790
|
+
# `'c'` |Whether the entity is a character device.
|
|
1791
|
+
# `'d'` |Whether the entity is a directory.
|
|
1792
|
+
# `'e'` |Whether the entity is an existing entity.
|
|
1793
|
+
# `'f'` |Whether the entity is an existing regular file.
|
|
1794
|
+
# `'g'` |Whether the entity's setgid bit is set.
|
|
1795
|
+
# `'G'` |Whether the entity's group ownership is equal to the caller's.
|
|
1796
|
+
# `'k'` |Whether the entity's sticky bit is set.
|
|
1797
|
+
# `'l'` |Whether the entity is a symbolic link.
|
|
1798
|
+
# `'o'` |Whether the entity is owned by the caller's effective uid.
|
|
1799
|
+
# `'O'` |Like `'o'`, but uses the real uid (not the effective uid).
|
|
1800
|
+
# `'p'` |Whether the entity is a FIFO device (named pipe).
|
|
1801
|
+
# `'r'` |Whether the entity is readable by the caller's effective uid/gid.
|
|
1802
|
+
# `'R'` |Like `'r'`, but uses the real uid/gid (not the effective uid/gid).
|
|
1803
|
+
# `'S'` |Whether the entity is a socket.
|
|
1804
|
+
# `'u'` |Whether the entity's setuid bit is set.
|
|
1805
|
+
# `'w'` |Whether the entity is writable by the caller's effective uid/gid.
|
|
1806
|
+
# `'W'` |Like `'w'`, but uses the real uid/gid (not the effective uid/gid).
|
|
1807
|
+
# `'x'` |Whether the entity is executable by the caller's effective uid/gid.
|
|
1808
|
+
# `'X'` |Like `'x'`, but uses the real uid/gid (not the effective uid/git).
|
|
1809
|
+
# `'z'` |Whether the entity exists and is of length zero.
|
|
1799
1810
|
# * This test operates only on the entity at `path0`,
|
|
1800
1811
|
# and returns an integer size or `nil`:
|
|
1801
|
-
#
|
|
1802
|
-
#
|
|
1803
|
-
#
|
|
1812
|
+
# Character|Test
|
|
1813
|
+
# ---------|--------------------------------------------------------------------------------------------
|
|
1814
|
+
# `'s'` |Returns positive integer size if the entity exists and has non-zero length, `nil` otherwise.
|
|
1804
1815
|
# * Each of these tests operates only on the entity at `path0`,
|
|
1805
1816
|
# and returns a Time object;
|
|
1806
1817
|
# raises an exception if the entity does not exist:
|
|
1807
|
-
#
|
|
1808
|
-
#
|
|
1809
|
-
#
|
|
1810
|
-
#
|
|
1811
|
-
#
|
|
1818
|
+
# Character|Test
|
|
1819
|
+
# ---------|--------------------------------------
|
|
1820
|
+
# `'A'` |Last access time for the entity.
|
|
1821
|
+
# `'C'` |Last change time for the entity.
|
|
1822
|
+
# `'M'` |Last modification time for the entity.
|
|
1812
1823
|
# * Each of these tests operates on the modification time (`mtime`)
|
|
1813
1824
|
# of each of the entities at `path0` and `path1`,
|
|
1814
1825
|
# and returns a `true` or `false`;
|
|
1815
1826
|
# returns `false` if either entity does not exist:
|
|
1816
|
-
#
|
|
1817
|
-
#
|
|
1818
|
-
#
|
|
1819
|
-
#
|
|
1820
|
-
#
|
|
1827
|
+
# Character|Test
|
|
1828
|
+
# ---------|---------------------------------------------------------------
|
|
1829
|
+
# `'<'` |Whether the `mtime` at `path0` is less than that at `path1`.
|
|
1830
|
+
# `'='` |Whether the `mtime` at `path0` is equal to that at `path1`.
|
|
1831
|
+
# `'>'` |Whether the `mtime` at `path0` is greater than that at `path1`.
|
|
1821
1832
|
# * This test operates on the content of each of the entities at `path0` and
|
|
1822
1833
|
# `path1`,
|
|
1823
1834
|
# and returns a `true` or `false`;
|
|
1824
1835
|
# returns `false` if either entity does not exist:
|
|
1825
|
-
#
|
|
1826
|
-
#
|
|
1827
|
-
#
|
|
1836
|
+
# Character|Test
|
|
1837
|
+
# ---------|---------------------------------------------
|
|
1838
|
+
# `'-'` |Whether the entities exist and are identical.
|
|
1828
1839
|
#
|
|
1829
1840
|
def self?.test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
|
|
1830
1841
|
|
|
@@ -1901,7 +1912,7 @@ module Kernel : BasicObject
|
|
|
1901
1912
|
# * Invoking the executable at `exe_path`.
|
|
1902
1913
|
#
|
|
1903
1914
|
# This method has potential security vulnerabilities if called with untrusted
|
|
1904
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
1915
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
1905
1916
|
#
|
|
1906
1917
|
# The new process is created using the [exec system
|
|
1907
1918
|
# call](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/e
|
|
@@ -1977,8 +1988,8 @@ module Kernel : BasicObject
|
|
|
1977
1988
|
#
|
|
1978
1989
|
# Raises an exception if the new process could not execute.
|
|
1979
1990
|
#
|
|
1980
|
-
def self?.exec: (String command, *String args, ?unsetenv_others:
|
|
1981
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others:
|
|
1991
|
+
def self?.exec: (String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> bot
|
|
1992
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> bot
|
|
1982
1993
|
|
|
1983
1994
|
type redirect_fd = Integer | :in | :out | :err | IO | String | [ String ] | [ String, string | int ] | [ String, string | int, int ] | [ :child, int ] | :close
|
|
1984
1995
|
|
|
@@ -1993,7 +2004,7 @@ module Kernel : BasicObject
|
|
|
1993
2004
|
# * Invoking the executable at `exe_path`.
|
|
1994
2005
|
#
|
|
1995
2006
|
# This method has potential security vulnerabilities if called with untrusted
|
|
1996
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2007
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
1997
2008
|
#
|
|
1998
2009
|
# Returns the process ID (pid) of the new process, without waiting for it to
|
|
1999
2010
|
# complete.
|
|
@@ -2082,8 +2093,8 @@ module Kernel : BasicObject
|
|
|
2082
2093
|
#
|
|
2083
2094
|
# Raises an exception if the new process could not execute.
|
|
2084
2095
|
#
|
|
2085
|
-
def self?.spawn: (String command, *String args, ?unsetenv_others:
|
|
2086
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others:
|
|
2096
|
+
def self?.spawn: (String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> Integer
|
|
2097
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String) -> Integer
|
|
2087
2098
|
|
|
2088
2099
|
# <!--
|
|
2089
2100
|
# rdoc-file=process.c
|
|
@@ -2096,7 +2107,7 @@ module Kernel : BasicObject
|
|
|
2096
2107
|
# * Invoking the executable at `exe_path`.
|
|
2097
2108
|
#
|
|
2098
2109
|
# This method has potential security vulnerabilities if called with untrusted
|
|
2099
|
-
# input; see [Command Injection](rdoc-ref:command_injection.rdoc).
|
|
2110
|
+
# input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
|
|
2100
2111
|
#
|
|
2101
2112
|
# Returns:
|
|
2102
2113
|
#
|
|
@@ -2200,8 +2211,8 @@ module Kernel : BasicObject
|
|
|
2200
2211
|
#
|
|
2201
2212
|
# Raises an exception if the new process could not execute.
|
|
2202
2213
|
#
|
|
2203
|
-
def self?.system: (String command, *String args, ?unsetenv_others:
|
|
2204
|
-
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others:
|
|
2214
|
+
def self?.system: (String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String, ?exception: bool) -> (NilClass | FalseClass | TrueClass)
|
|
2215
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: bool, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: bool, ?chdir: String, ?exception: bool) -> (NilClass | FalseClass | TrueClass)
|
|
2205
2216
|
|
|
2206
2217
|
# <!--
|
|
2207
2218
|
# rdoc-file=object.c
|
data/core/marshal.rbs
CHANGED
|
@@ -147,7 +147,7 @@ module Marshal
|
|
|
147
147
|
# * anonymous Class/Module.
|
|
148
148
|
# * objects which are related to system (ex: Dir, File::Stat, IO, File, Socket
|
|
149
149
|
# and so on)
|
|
150
|
-
# * an instance of MatchData,
|
|
150
|
+
# * an instance of MatchData, Method, UnboundMethod, Proc, Thread,
|
|
151
151
|
# ThreadGroup, Continuation
|
|
152
152
|
# * objects which define singleton methods
|
|
153
153
|
#
|
data/core/match_data.rbs
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
# * `$'` is Regexp.last_match`.post_match`;
|
|
42
42
|
# * `$+` is Regexp.last_match`[ -1 ]` (the last capture).
|
|
43
43
|
#
|
|
44
|
-
# See also
|
|
44
|
+
# See also Regexp@Global+Variables.
|
|
45
45
|
#
|
|
46
46
|
class MatchData
|
|
47
47
|
type capture = String | Symbol | int
|
data/core/math.rbs
CHANGED
|
@@ -410,6 +410,27 @@ module Math
|
|
|
410
410
|
#
|
|
411
411
|
def self.exp: (double x) -> Float
|
|
412
412
|
|
|
413
|
+
# <!--
|
|
414
|
+
# rdoc-file=math.c
|
|
415
|
+
# - Math.expm1(x) -> float
|
|
416
|
+
# -->
|
|
417
|
+
# Returns "exp(x) - 1", `e` raised to the `x` power, minus 1.
|
|
418
|
+
#
|
|
419
|
+
# * Domain: `[-INFINITY, INFINITY]`.
|
|
420
|
+
# * Range: `[-1.0, INFINITY]`.
|
|
421
|
+
#
|
|
422
|
+
# Examples:
|
|
423
|
+
#
|
|
424
|
+
# expm1(-INFINITY) # => 0.0
|
|
425
|
+
# expm1(-1.0) # => -0.6321205588285577 # 1.0/E - 1
|
|
426
|
+
# expm1(0.0) # => 0.0
|
|
427
|
+
# expm1(0.5) # => 0.6487212707001282 # sqrt(E) - 1
|
|
428
|
+
# expm1(1.0) # => 1.718281828459045 # E - 1
|
|
429
|
+
# expm1(2.0) # => 6.38905609893065 # E**2 - 1
|
|
430
|
+
# expm1(INFINITY) # => Infinity
|
|
431
|
+
#
|
|
432
|
+
def self.expm1: (double x) -> Float
|
|
433
|
+
|
|
413
434
|
# <!--
|
|
414
435
|
# rdoc-file=math.c
|
|
415
436
|
# - Math.frexp(x) -> [fraction, exponent]
|
|
@@ -525,9 +546,8 @@ module Math
|
|
|
525
546
|
#
|
|
526
547
|
# [Math.log(Math.gamma(x).abs), Math.gamma(x) < 0 ? -1 : 1]
|
|
527
548
|
#
|
|
528
|
-
# See [
|
|
529
|
-
# function](https://en.wikipedia.org/wiki/Gamma_function#
|
|
530
|
-
# .
|
|
549
|
+
# See [log gamma
|
|
550
|
+
# function](https://en.wikipedia.org/wiki/Gamma_function#Log-gamma_function).
|
|
531
551
|
#
|
|
532
552
|
# * Domain: `(-INFINITY, INFINITY]`.
|
|
533
553
|
# * Range of first element: `(-INFINITY, INFINITY]`.
|
|
@@ -603,6 +623,25 @@ module Math
|
|
|
603
623
|
#
|
|
604
624
|
def self.log10: (double x) -> Float
|
|
605
625
|
|
|
626
|
+
# <!--
|
|
627
|
+
# rdoc-file=math.c
|
|
628
|
+
# - Math.log1p(x) -> float
|
|
629
|
+
# -->
|
|
630
|
+
# Returns "log(x + 1)", the base E
|
|
631
|
+
# [logarithm](https://en.wikipedia.org/wiki/Logarithm) of (`x` + 1).
|
|
632
|
+
#
|
|
633
|
+
# * Domain: `[-1, INFINITY]`.
|
|
634
|
+
# * Range: `[-INFINITY, INFINITY]`.
|
|
635
|
+
#
|
|
636
|
+
# Examples:
|
|
637
|
+
#
|
|
638
|
+
# log1p(-1.0) # => -Infinity
|
|
639
|
+
# log1p(0.0) # => 0.0
|
|
640
|
+
# log1p(E - 1) # => 1.0
|
|
641
|
+
# log1p(INFINITY) # => Infinity
|
|
642
|
+
#
|
|
643
|
+
def self.log1p: (double x) -> Float
|
|
644
|
+
|
|
606
645
|
# <!--
|
|
607
646
|
# rdoc-file=math.c
|
|
608
647
|
# - Math.log2(x) -> float
|