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.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +14 -14
  3. data/.github/workflows/bundle-update.yml +60 -0
  4. data/.github/workflows/c-check.yml +11 -8
  5. data/.github/workflows/comments.yml +3 -3
  6. data/.github/workflows/dependabot.yml +1 -1
  7. data/.github/workflows/ruby.yml +17 -34
  8. data/.github/workflows/typecheck.yml +2 -2
  9. data/.github/workflows/valgrind.yml +42 -0
  10. data/.github/workflows/windows.yml +2 -2
  11. data/.rubocop.yml +1 -1
  12. data/README.md +1 -1
  13. data/Rakefile +32 -5
  14. data/config.yml +46 -0
  15. data/core/array.rbs +96 -46
  16. data/core/binding.rbs +0 -2
  17. data/core/builtin.rbs +2 -2
  18. data/core/comparable.rbs +13 -6
  19. data/core/complex.rbs +55 -41
  20. data/core/dir.rbs +4 -4
  21. data/core/encoding.rbs +7 -10
  22. data/core/enumerable.rbs +90 -3
  23. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  24. data/core/enumerator.rbs +63 -1
  25. data/core/errno.rbs +8 -0
  26. data/core/errors.rbs +28 -1
  27. data/core/exception.rbs +2 -2
  28. data/core/fiber.rbs +40 -20
  29. data/core/file.rbs +108 -78
  30. data/core/file_test.rbs +1 -1
  31. data/core/float.rbs +225 -69
  32. data/core/gc.rbs +417 -281
  33. data/core/hash.rbs +1023 -727
  34. data/core/integer.rbs +104 -110
  35. data/core/io/buffer.rbs +21 -10
  36. data/core/io/wait.rbs +11 -33
  37. data/core/io.rbs +82 -19
  38. data/core/kernel.rbs +70 -59
  39. data/core/marshal.rbs +1 -1
  40. data/core/match_data.rbs +1 -1
  41. data/core/math.rbs +42 -3
  42. data/core/method.rbs +63 -27
  43. data/core/module.rbs +103 -26
  44. data/core/nil_class.rbs +3 -3
  45. data/core/numeric.rbs +43 -35
  46. data/core/object.rbs +3 -3
  47. data/core/object_space.rbs +21 -15
  48. data/core/pathname.rbs +1272 -0
  49. data/core/proc.rbs +30 -25
  50. data/core/process.rbs +4 -2
  51. data/core/ractor.rbs +361 -509
  52. data/core/random.rbs +17 -0
  53. data/core/range.rbs +113 -16
  54. data/core/rational.rbs +56 -85
  55. data/core/rbs/unnamed/argf.rbs +2 -2
  56. data/core/rbs/unnamed/env_class.rbs +1 -1
  57. data/core/rbs/unnamed/random.rbs +4 -113
  58. data/core/regexp.rbs +25 -20
  59. data/core/ruby.rbs +53 -0
  60. data/core/ruby_vm.rbs +6 -4
  61. data/core/rubygems/errors.rbs +3 -70
  62. data/core/rubygems/rubygems.rbs +11 -79
  63. data/core/rubygems/version.rbs +2 -3
  64. data/core/set.rbs +488 -359
  65. data/core/signal.rbs +24 -14
  66. data/core/string.rbs +3171 -1241
  67. data/core/struct.rbs +1 -1
  68. data/core/symbol.rbs +17 -11
  69. data/core/thread.rbs +95 -33
  70. data/core/time.rbs +35 -9
  71. data/core/trace_point.rbs +7 -4
  72. data/core/unbound_method.rbs +14 -6
  73. data/docs/aliases.md +79 -0
  74. data/docs/collection.md +2 -2
  75. data/docs/encoding.md +56 -0
  76. data/docs/gem.md +0 -1
  77. data/docs/inline.md +470 -0
  78. data/docs/sigs.md +3 -3
  79. data/docs/syntax.md +33 -4
  80. data/docs/type_fingerprint.md +21 -0
  81. data/exe/rbs +1 -1
  82. data/ext/rbs_extension/ast_translation.c +77 -3
  83. data/ext/rbs_extension/ast_translation.h +3 -0
  84. data/ext/rbs_extension/class_constants.c +8 -2
  85. data/ext/rbs_extension/class_constants.h +4 -0
  86. data/ext/rbs_extension/extconf.rb +5 -1
  87. data/ext/rbs_extension/legacy_location.c +5 -5
  88. data/ext/rbs_extension/main.c +37 -20
  89. data/include/rbs/ast.h +85 -38
  90. data/include/rbs/defines.h +27 -0
  91. data/include/rbs/lexer.h +30 -11
  92. data/include/rbs/parser.h +6 -6
  93. data/include/rbs/string.h +0 -2
  94. data/include/rbs/util/rbs_allocator.h +34 -13
  95. data/include/rbs/util/rbs_assert.h +12 -1
  96. data/include/rbs/util/rbs_encoding.h +2 -0
  97. data/include/rbs/util/rbs_unescape.h +2 -1
  98. data/lib/rbs/ast/annotation.rb +1 -1
  99. data/lib/rbs/ast/comment.rb +1 -1
  100. data/lib/rbs/ast/declarations.rb +10 -10
  101. data/lib/rbs/ast/members.rb +14 -14
  102. data/lib/rbs/ast/ruby/annotations.rb +137 -0
  103. data/lib/rbs/ast/ruby/comment_block.rb +24 -0
  104. data/lib/rbs/ast/ruby/declarations.rb +198 -3
  105. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +4 -0
  106. data/lib/rbs/ast/ruby/members.rb +159 -1
  107. data/lib/rbs/ast/type_param.rb +24 -4
  108. data/lib/rbs/buffer.rb +20 -15
  109. data/lib/rbs/cli/diff.rb +16 -15
  110. data/lib/rbs/cli/validate.rb +38 -51
  111. data/lib/rbs/cli.rb +52 -19
  112. data/lib/rbs/collection/config/lockfile_generator.rb +8 -0
  113. data/lib/rbs/collection/sources/git.rb +1 -0
  114. data/lib/rbs/definition.rb +1 -1
  115. data/lib/rbs/definition_builder/ancestor_builder.rb +62 -9
  116. data/lib/rbs/definition_builder/method_builder.rb +20 -0
  117. data/lib/rbs/definition_builder.rb +91 -2
  118. data/lib/rbs/diff.rb +7 -1
  119. data/lib/rbs/environment.rb +227 -74
  120. data/lib/rbs/environment_loader.rb +0 -6
  121. data/lib/rbs/errors.rb +27 -7
  122. data/lib/rbs/inline_parser.rb +341 -5
  123. data/lib/rbs/location_aux.rb +1 -1
  124. data/lib/rbs/locator.rb +5 -1
  125. data/lib/rbs/method_type.rb +5 -3
  126. data/lib/rbs/parser_aux.rb +2 -2
  127. data/lib/rbs/prototype/rb.rb +2 -2
  128. data/lib/rbs/prototype/rbi.rb +2 -0
  129. data/lib/rbs/prototype/runtime.rb +8 -0
  130. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  131. data/lib/rbs/resolver/type_name_resolver.rb +116 -38
  132. data/lib/rbs/subtractor.rb +3 -1
  133. data/lib/rbs/test/type_check.rb +16 -2
  134. data/lib/rbs/type_name.rb +1 -1
  135. data/lib/rbs/types.rb +27 -27
  136. data/lib/rbs/validator.rb +2 -2
  137. data/lib/rbs/version.rb +1 -1
  138. data/lib/rbs.rb +1 -1
  139. data/lib/rdoc/discover.rb +1 -1
  140. data/lib/rdoc_plugin/parser.rb +1 -1
  141. data/rbs.gemspec +3 -2
  142. data/schema/typeParam.json +17 -1
  143. data/sig/ast/ruby/annotations.rbs +124 -0
  144. data/sig/ast/ruby/comment_block.rbs +8 -0
  145. data/sig/ast/ruby/declarations.rbs +102 -4
  146. data/sig/ast/ruby/members.rbs +87 -1
  147. data/sig/cli/diff.rbs +5 -11
  148. data/sig/cli/validate.rbs +13 -4
  149. data/sig/cli.rbs +18 -18
  150. data/sig/definition.rbs +6 -1
  151. data/sig/environment.rbs +70 -12
  152. data/sig/errors.rbs +13 -6
  153. data/sig/inline_parser.rbs +39 -2
  154. data/sig/locator.rbs +0 -2
  155. data/sig/manifest.yaml +0 -1
  156. data/sig/method_builder.rbs +3 -1
  157. data/sig/method_types.rbs +1 -1
  158. data/sig/parser.rbs +16 -2
  159. data/sig/resolver/type_name_resolver.rbs +35 -7
  160. data/sig/source.rbs +3 -3
  161. data/sig/type_param.rbs +13 -8
  162. data/sig/types.rbs +4 -4
  163. data/src/ast.c +80 -1
  164. data/src/lexer.c +1392 -1313
  165. data/src/lexer.re +3 -0
  166. data/src/lexstate.c +58 -37
  167. data/src/location.c +4 -4
  168. data/src/parser.c +412 -145
  169. data/src/string.c +0 -48
  170. data/src/util/rbs_allocator.c +89 -71
  171. data/src/util/rbs_assert.c +1 -1
  172. data/src/util/rbs_buffer.c +2 -2
  173. data/src/util/rbs_constant_pool.c +10 -10
  174. data/src/util/rbs_encoding.c +4 -8
  175. data/src/util/rbs_unescape.c +56 -20
  176. data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
  177. data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
  178. data/stdlib/cgi/0/core.rbs +9 -393
  179. data/stdlib/cgi/0/manifest.yaml +1 -0
  180. data/stdlib/cgi-escape/0/escape.rbs +171 -0
  181. data/stdlib/coverage/0/coverage.rbs +3 -1
  182. data/stdlib/date/0/date.rbs +67 -59
  183. data/stdlib/date/0/date_time.rbs +1 -1
  184. data/stdlib/delegate/0/delegator.rbs +10 -7
  185. data/stdlib/digest/0/digest.rbs +110 -0
  186. data/stdlib/erb/0/erb.rbs +737 -347
  187. data/stdlib/fileutils/0/fileutils.rbs +20 -14
  188. data/stdlib/forwardable/0/forwardable.rbs +3 -0
  189. data/stdlib/json/0/json.rbs +82 -28
  190. data/stdlib/net-http/0/net-http.rbs +3 -0
  191. data/stdlib/objspace/0/objspace.rbs +9 -27
  192. data/stdlib/open-uri/0/open-uri.rbs +40 -0
  193. data/stdlib/open3/0/open3.rbs +459 -1
  194. data/stdlib/openssl/0/openssl.rbs +331 -228
  195. data/stdlib/optparse/0/optparse.rbs +8 -3
  196. data/stdlib/pathname/0/pathname.rbs +9 -1379
  197. data/stdlib/psych/0/psych.rbs +4 -4
  198. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  199. data/stdlib/rdoc/0/code_object.rbs +2 -1
  200. data/stdlib/rdoc/0/parser.rbs +1 -1
  201. data/stdlib/rdoc/0/rdoc.rbs +1 -1
  202. data/stdlib/rdoc/0/store.rbs +1 -1
  203. data/stdlib/resolv/0/resolv.rbs +25 -68
  204. data/stdlib/ripper/0/ripper.rbs +2 -2
  205. data/stdlib/securerandom/0/manifest.yaml +2 -0
  206. data/stdlib/securerandom/0/securerandom.rbs +6 -19
  207. data/stdlib/singleton/0/singleton.rbs +3 -0
  208. data/stdlib/socket/0/socket.rbs +13 -1
  209. data/stdlib/socket/0/tcp_socket.rbs +10 -2
  210. data/stdlib/stringio/0/stringio.rbs +1176 -85
  211. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  212. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  213. data/stdlib/time/0/time.rbs +1 -1
  214. data/stdlib/timeout/0/timeout.rbs +63 -7
  215. data/stdlib/tsort/0/cyclic.rbs +3 -0
  216. data/stdlib/uri/0/common.rbs +16 -2
  217. data/stdlib/uri/0/file.rbs +1 -1
  218. data/stdlib/uri/0/generic.rbs +24 -16
  219. data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
  220. data/stdlib/zlib/0/gzip_reader.rbs +2 -2
  221. data/stdlib/zlib/0/gzip_writer.rbs +1 -1
  222. data/stdlib/zlib/0/zstream.rbs +1 -0
  223. 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, and
2365
- # the block's value is assigned to global variable `$?` and returned.
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 \Process**
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: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) -> instance
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: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) -> instance
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: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) { (instance) -> X } -> X
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: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) { (instance) -> X } -> X
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: (string | _ToPath 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
2598
- | (string | _ToPath 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]
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: (String | _ToPath 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]
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 <tt.$stdout.putc(object)</tt> for the given object.
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: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
208
- | (?::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
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
- # $ $?.status # => 99>
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
- # See also Random.rand.
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
- # Character |Test
1777
- # ------------|-------------------------------------------------------------------------
1778
- # <tt>'b'</tt>|Whether the entity is a block device.
1779
- # <tt>'c'</tt>|Whether the entity is a character device.
1780
- # <tt>'d'</tt>|Whether the entity is a directory.
1781
- # <tt>'e'</tt>|Whether the entity is an existing entity.
1782
- # <tt>'f'</tt>|Whether the entity is an existing regular file.
1783
- # <tt>'g'</tt>|Whether the entity's setgid bit is set.
1784
- # <tt>'G'</tt>|Whether the entity's group ownership is equal to the caller's.
1785
- # <tt>'k'</tt>|Whether the entity's sticky bit is set.
1786
- # <tt>'l'</tt>|Whether the entity is a symbolic link.
1787
- # <tt>'o'</tt>|Whether the entity is owned by the caller's effective uid.
1788
- # <tt>'O'</tt>|Like <tt>'o'</tt>, but uses the real uid (not the effective uid).
1789
- # <tt>'p'</tt>|Whether the entity is a FIFO device (named pipe).
1790
- # <tt>'r'</tt>|Whether the entity is readable by the caller's effective uid/gid.
1791
- # <tt>'R'</tt>|Like <tt>'r'</tt>, but uses the real uid/gid (not the effective uid/gid).
1792
- # <tt>'S'</tt>|Whether the entity is a socket.
1793
- # <tt>'u'</tt>|Whether the entity's setuid bit is set.
1794
- # <tt>'w'</tt>|Whether the entity is writable by the caller's effective uid/gid.
1795
- # <tt>'W'</tt>|Like <tt>'w'</tt>, but uses the real uid/gid (not the effective uid/gid).
1796
- # <tt>'x'</tt>|Whether the entity is executable by the caller's effective uid/gid.
1797
- # <tt>'X'</tt>|Like <tt>'x'</tt>, but uses the real uid/gid (not the effective uid/git).
1798
- # <tt>'z'</tt>|Whether the entity exists and is of length zero.
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
- # Character |Test
1802
- # ------------|--------------------------------------------------------------------------------------------
1803
- # <tt>'s'</tt>|Returns positive integer size if the entity exists and has non-zero length, +nil+ otherwise.
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
- # Character |Test
1808
- # ------------|--------------------------------------
1809
- # <tt>'A'</tt>|Last access time for the entity.
1810
- # <tt>'C'</tt>|Last change time for the entity.
1811
- # <tt>'M'</tt>|Last modification time for the entity.
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
- # Character |Test
1817
- # ------------|---------------------------------------------------------------
1818
- # <tt>'<'</tt>|Whether the `mtime` at `path0` is less than that at `path1`.
1819
- # <tt>'='</tt>|Whether the `mtime` at `path0` is equal to that at `path1`.
1820
- # <tt>'>'</tt>|Whether the `mtime` at `path0` is greater than that at `path1`.
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
- # Character |Test
1826
- # ------------|---------------------------------------------
1827
- # <tt>'-'</tt>|Whether the entities exist and are identical.
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: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> bot
1981
- | (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> bot
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: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> Integer
2086
- | (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> Integer
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: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String, ?exception: bool) -> (NilClass | FalseClass | TrueClass)
2204
- | (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String, ?exception: bool) -> (NilClass | FalseClass | TrueClass)
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, Data, Method, UnboundMethod, Proc, Thread,
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 "Special global variables" section in Regexp documentation.
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 [logarithmic gamma
529
- # function](https://en.wikipedia.org/wiki/Gamma_function#The_log-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