rbs 3.7.0.pre.1 → 3.8.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +3 -3
  3. data/.github/workflows/ruby.yml +7 -7
  4. data/CHANGELOG.md +58 -0
  5. data/core/array.rbs +1743 -1580
  6. data/core/basic_object.rbs +38 -35
  7. data/core/comparable.rbs +1 -1
  8. data/core/complex.rbs +165 -93
  9. data/core/data.rbs +1 -1
  10. data/core/dir.rbs +1 -17
  11. data/core/encoding.rbs +12 -6
  12. data/core/enumerable.rbs +270 -266
  13. data/core/enumerator.rbs +0 -2
  14. data/core/env.rbs +1 -1
  15. data/core/errno.rbs +33 -16
  16. data/core/errors.rbs +2 -2
  17. data/core/exception.rbs +236 -170
  18. data/core/fiber.rbs +3 -2
  19. data/core/file.rbs +32 -74
  20. data/core/float.rbs +125 -72
  21. data/core/gc.rbs +138 -40
  22. data/core/hash.rbs +120 -141
  23. data/core/integer.rbs +79 -50
  24. data/core/io/buffer.rbs +49 -43
  25. data/core/io.rbs +97 -144
  26. data/core/kernel.rbs +290 -200
  27. data/core/match_data.rbs +76 -2
  28. data/core/math.rbs +0 -36
  29. data/core/module.rbs +28 -23
  30. data/core/nil_class.rbs +0 -3
  31. data/core/numeric.rbs +100 -103
  32. data/core/object.rbs +0 -4
  33. data/core/object_space/weak_key_map.rbs +3 -4
  34. data/core/object_space.rbs +3 -3
  35. data/core/proc.rbs +0 -2
  36. data/core/process.rbs +109 -57
  37. data/core/ractor.rbs +37 -4
  38. data/core/range.rbs +114 -87
  39. data/core/rational.rbs +0 -2
  40. data/core/rbs/unnamed/argf.rbs +234 -33
  41. data/core/rbs/unnamed/env_class.rbs +35 -53
  42. data/core/rbs/unnamed/random.rbs +1 -2
  43. data/core/regexp.rbs +4 -52
  44. data/core/ruby_vm.rbs +88 -9
  45. data/core/rubygems/config_file.rbs +3 -0
  46. data/core/rubygems/errors.rbs +0 -5
  47. data/core/rubygems/platform.rbs +0 -9
  48. data/core/rubygems/rubygems.rbs +0 -5
  49. data/core/rubygems/version.rbs +6 -6
  50. data/core/set.rbs +3 -15
  51. data/core/string.rbs +130 -136
  52. data/core/struct.rbs +6 -18
  53. data/core/symbol.rbs +14 -21
  54. data/core/thread.rbs +32 -35
  55. data/core/time.rbs +127 -50
  56. data/core/trace_point.rbs +16 -0
  57. data/core/true_class.rbs +0 -1
  58. data/core/warning.rbs +9 -2
  59. data/docs/architecture.md +1 -1
  60. data/docs/syntax.md +1 -1
  61. data/ext/rbs_extension/location.c +29 -19
  62. data/ext/rbs_extension/parser.c +267 -292
  63. data/ext/rbs_extension/parserstate.c +56 -22
  64. data/lib/rbs/annotate/annotations.rb +3 -3
  65. data/lib/rbs/annotate/rdoc_source.rb +2 -2
  66. data/lib/rbs/cli/diff.rb +3 -3
  67. data/lib/rbs/cli/validate.rb +1 -1
  68. data/lib/rbs/cli.rb +13 -13
  69. data/lib/rbs/collection/config.rb +3 -1
  70. data/lib/rbs/definition_builder/ancestor_builder.rb +3 -3
  71. data/lib/rbs/environment_loader.rb +1 -1
  72. data/lib/rbs/namespace.rb +1 -0
  73. data/lib/rbs/parser_aux.rb +2 -2
  74. data/lib/rbs/prototype/rb.rb +11 -8
  75. data/lib/rbs/prototype/rbi.rb +9 -5
  76. data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
  77. data/lib/rbs/prototype/runtime.rb +4 -5
  78. data/lib/rbs/type_name.rb +14 -9
  79. data/lib/rbs/unit_test/type_assertions.rb +2 -2
  80. data/lib/rbs/validator.rb +3 -1
  81. data/lib/rbs/version.rb +1 -1
  82. data/lib/rdoc_plugin/parser.rb +2 -2
  83. data/rbs.gemspec +4 -0
  84. data/sig/ancestor_graph.rbs +4 -4
  85. data/sig/namespace.rbs +2 -3
  86. data/sig/resolver/constant_resolver.rbs +2 -2
  87. data/sig/resolver/context.rbs +1 -1
  88. data/sig/type_alias_regularity.rbs +5 -5
  89. data/sig/typename.rbs +8 -5
  90. data/sig/use_map.rbs +1 -1
  91. data/sig/validator.rbs +2 -2
  92. data/stdlib/base64/0/base64.rbs +0 -9
  93. data/stdlib/benchmark/0/benchmark.rbs +11 -2
  94. data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
  95. data/stdlib/cgi/0/core.rbs +47 -0
  96. data/stdlib/coverage/0/coverage.rbs +0 -3
  97. data/stdlib/csv/0/csv.rbs +18 -58
  98. data/stdlib/date/0/date.rbs +4 -19
  99. data/stdlib/did_you_mean/0/did_you_mean.rbs +0 -5
  100. data/stdlib/digest/0/digest.rbs +25 -2
  101. data/stdlib/erb/0/erb.rbs +0 -1
  102. data/stdlib/etc/0/etc.rbs +51 -34
  103. data/stdlib/fileutils/0/fileutils.rbs +3 -44
  104. data/stdlib/io-console/0/io-console.rbs +69 -15
  105. data/stdlib/ipaddr/0/ipaddr.rbs +8 -4
  106. data/stdlib/json/0/json.rbs +56 -71
  107. data/stdlib/logger/0/log_device.rbs +1 -1
  108. data/stdlib/logger/0/logger.rbs +3 -18
  109. data/stdlib/net-http/0/net-http.rbs +19 -77
  110. data/stdlib/nkf/0/nkf.rbs +30 -0
  111. data/stdlib/objspace/0/objspace.rbs +1 -2
  112. data/stdlib/observable/0/observable.rbs +1 -1
  113. data/stdlib/open-uri/0/open-uri.rbs +52 -0
  114. data/stdlib/open3/0/open3.rbs +0 -8
  115. data/stdlib/openssl/0/openssl.rbs +136 -69
  116. data/stdlib/optparse/0/optparse.rbs +58 -18
  117. data/stdlib/pathname/0/pathname.rbs +2 -8
  118. data/stdlib/pp/0/pp.rbs +3 -1
  119. data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
  120. data/stdlib/pstore/0/pstore.rbs +0 -6
  121. data/stdlib/psych/0/psych.rbs +15 -4
  122. data/stdlib/pty/0/pty.rbs +46 -4
  123. data/stdlib/rdoc/0/code_object.rbs +0 -4
  124. data/stdlib/rdoc/0/markup.rbs +10 -12
  125. data/stdlib/rdoc/0/rdoc.rbs +1 -2
  126. data/stdlib/resolv/0/resolv.rbs +8 -3
  127. data/stdlib/ripper/0/ripper.rbs +0 -2
  128. data/stdlib/securerandom/0/securerandom.rbs +0 -2
  129. data/stdlib/shellwords/0/shellwords.rbs +11 -12
  130. data/stdlib/singleton/0/singleton.rbs +0 -1
  131. data/stdlib/socket/0/addrinfo.rbs +0 -1
  132. data/stdlib/socket/0/basic_socket.rbs +0 -5
  133. data/stdlib/socket/0/socket.rbs +49 -25
  134. data/stdlib/socket/0/tcp_server.rbs +0 -3
  135. data/stdlib/socket/0/tcp_socket.rbs +58 -3
  136. data/stdlib/socket/0/udp_socket.rbs +0 -1
  137. data/stdlib/socket/0/unix_server.rbs +0 -3
  138. data/stdlib/strscan/0/string_scanner.rbs +1265 -422
  139. data/stdlib/tempfile/0/tempfile.rbs +135 -28
  140. data/stdlib/time/0/time.rbs +48 -35
  141. data/stdlib/timeout/0/timeout.rbs +11 -8
  142. data/stdlib/tmpdir/0/tmpdir.rbs +8 -1
  143. data/stdlib/tsort/0/tsort.rbs +0 -4
  144. data/stdlib/uri/0/common.rbs +11 -30
  145. data/stdlib/uri/0/ftp.rbs +1 -1
  146. data/stdlib/uri/0/generic.rbs +22 -18
  147. data/stdlib/uri/0/http.rbs +2 -2
  148. data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
  149. data/stdlib/zlib/0/buf_error.rbs +1 -70
  150. data/stdlib/zlib/0/data_error.rbs +1 -70
  151. data/stdlib/zlib/0/deflate.rbs +8 -72
  152. data/stdlib/zlib/0/error.rbs +1 -70
  153. data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
  154. data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
  155. data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
  156. data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
  157. data/stdlib/zlib/0/gzip_file.rbs +1 -71
  158. data/stdlib/zlib/0/gzip_reader.rbs +3 -74
  159. data/stdlib/zlib/0/gzip_writer.rbs +1 -70
  160. data/stdlib/zlib/0/inflate.rbs +4 -71
  161. data/stdlib/zlib/0/mem_error.rbs +1 -70
  162. data/stdlib/zlib/0/need_dict.rbs +1 -70
  163. data/stdlib/zlib/0/stream_end.rbs +1 -70
  164. data/stdlib/zlib/0/stream_error.rbs +1 -70
  165. data/stdlib/zlib/0/version_error.rbs +1 -70
  166. data/stdlib/zlib/0/zlib.rbs +0 -2
  167. data/stdlib/zlib/0/zstream.rbs +4 -72
  168. metadata +4 -6
data/core/gc.rbs CHANGED
@@ -1,5 +1,5 @@
1
1
  # <!-- rdoc-file=gc.rb -->
2
- # The GC module provides an interface to Ruby's mark and sweep garbage
2
+ # The GC module provides an interface to Ruby's mark-and-sweep garbage
3
3
  # collection mechanism.
4
4
  #
5
5
  # Some of the underlying methods are also available via the ObjectSpace module.
@@ -81,14 +81,19 @@ module GC
81
81
  #
82
82
  # `:GC_TIME`
83
83
  # : Time elapsed in seconds for this GC run
84
+ #
84
85
  # `:GC_INVOKE_TIME`
85
86
  # : Time elapsed in seconds from startup to when the GC was invoked
87
+ #
86
88
  # `:HEAP_USE_SIZE`
87
89
  # : Total bytes of heap used
90
+ #
88
91
  # `:HEAP_TOTAL_SIZE`
89
92
  # : Total size of heap in bytes
93
+ #
90
94
  # `:HEAP_TOTAL_OBJECTS`
91
95
  # : Total number of objects
96
+ #
92
97
  # `:GC_IS_MARKED`
93
98
  # : Returns `true` if the GC is in mark phase
94
99
  #
@@ -154,17 +159,70 @@ module GC
154
159
 
155
160
  # <!--
156
161
  # rdoc-file=gc.rb
157
- # - GC.count -> Integer
162
+ # - GC.config -> hash
163
+ # - GC.config(hash) -> hash
158
164
  # -->
159
- # The number of times GC occurred.
165
+ # Sets or gets information about the current GC config.
166
+ #
167
+ # Configuration parameters are GC implementation-specific and may change without
168
+ # notice.
169
+ #
170
+ # This method can be called without parameters to retrieve the current config.
171
+ #
172
+ # This method can also be called with a `Hash` argument to assign values to
173
+ # valid config keys. Config keys missing from the passed `Hash` will be left
174
+ # unmodified.
175
+ #
176
+ # If a key/value pair is passed to this function that does not correspond to a
177
+ # valid config key for the GC implementation being used, no config will be
178
+ # updated, the key will be present in the returned Hash, and its value will be
179
+ # `nil`. This is to facilitate easy migration between GC implementations.
180
+ #
181
+ # In both call-seqs, the return value of `GC.config` will be a `Hash` containing
182
+ # the most recent full configuration, i.e., all keys and values defined by the
183
+ # specific GC implementation being used. In the case of a config update, the
184
+ # return value will include the new values being updated.
185
+ #
186
+ # This method is only expected to work on CRuby.
187
+ #
188
+ # Valid config keys for Ruby's default GC implementation are:
189
+ #
190
+ # rgengc_allow_full_mark
191
+ # : Controls whether the GC is allowed to run a full mark (young & old
192
+ # objects).
193
+ #
194
+ # When `true`, GC interleaves major and minor collections. This is the
195
+ # default. GC will function as intended.
196
+ #
197
+ # When `false`, the GC will never trigger a full marking cycle unless
198
+ # explicitly requested by user code. Instead, only a minor mark will
199
+ # run—only young objects will be marked. When the heap space is exhausted,
200
+ # new pages will be allocated immediately instead of running a full mark.
160
201
  #
161
- # It returns the number of times GC occurred since the process started.
202
+ # A flag will be set to notify that a full mark has been requested. This
203
+ # flag is accessible using `GC.latest_gc_info(:needs_major_by)`
204
+ #
205
+ # The user can trigger a major collection at any time using
206
+ # `GC.start(full_mark: true)`
207
+ #
208
+ # When `false`, Young to Old object promotion is disabled. For performance
209
+ # reasons, it is recommended to warm up an application using
210
+ # `Process.warmup` before setting this parameter to `false`.
211
+ #
212
+ def self.config: () -> Hash[Symbol, untyped]
213
+ | (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
214
+
215
+ # <!--
216
+ # rdoc-file=gc.rb
217
+ # - GC.count -> Integer
218
+ # -->
219
+ # Returns the number of times GC has occurred since the process started.
162
220
  #
163
221
  def self.count: () -> Integer
164
222
 
165
223
  # <!--
166
224
  # rdoc-file=gc.rb
167
- # - GC.disable -> true or false
225
+ # - GC.disable -> true or false
168
226
  # -->
169
227
  # Disables garbage collection, returning `true` if garbage collection was
170
228
  # already disabled.
@@ -176,7 +234,7 @@ module GC
176
234
 
177
235
  # <!--
178
236
  # rdoc-file=gc.rb
179
- # - GC.enable -> true or false
237
+ # - GC.enable -> true or false
180
238
  # -->
181
239
  # Enables garbage collection, returning `true` if garbage collection was
182
240
  # previously disabled.
@@ -195,24 +253,24 @@ module GC
195
253
  #
196
254
  # The `full_mark` keyword argument determines whether or not to perform a major
197
255
  # garbage collection cycle. When set to `true`, a major garbage collection cycle
198
- # is ran, meaning all objects are marked. When set to `false`, a minor garbage
199
- # collection cycle is ran, meaning only young objects are marked.
256
+ # is run, meaning all objects are marked. When set to `false`, a minor garbage
257
+ # collection cycle is run, meaning only young objects are marked.
200
258
  #
201
259
  # The `immediate_mark` keyword argument determines whether or not to perform
202
260
  # incremental marking. When set to `true`, marking is completed during the call
203
- # to this method. When set to `false`, marking is performed in steps that is
261
+ # to this method. When set to `false`, marking is performed in steps that are
204
262
  # interleaved with future Ruby code execution, so marking might not be completed
205
- # during this method call. Note that if `full_mark` is `false` then marking will
206
- # always be immediate, regardless of the value of `immediate_mark`.
263
+ # during this method call. Note that if `full_mark` is `false`, then marking
264
+ # will always be immediate, regardless of the value of `immediate_mark`.
207
265
  #
208
- # The `immedate_sweep` keyword argument determines whether or not to defer
209
- # sweeping (using lazy sweep). When set to `true`, sweeping is performed in
210
- # steps that is interleaved with future Ruby code execution, so sweeping might
211
- # not be completed during this method call. When set to `false`, sweeping is
266
+ # The `immediate_sweep` keyword argument determines whether or not to defer
267
+ # sweeping (using lazy sweep). When set to `false`, sweeping is performed in
268
+ # steps that are interleaved with future Ruby code execution, so sweeping might
269
+ # not be completed during this method call. When set to `true`, sweeping is
212
270
  # completed during the call to this method.
213
271
  #
214
- # Note: These keyword arguments are implementation and version dependent. They
215
- # are not guaranteed to be future-compatible, and may be ignored if the
272
+ # Note: These keyword arguments are implementation and version-dependent. They
273
+ # are not guaranteed to be future-compatible and may be ignored if the
216
274
  # underlying implementation does not support them.
217
275
  #
218
276
  def self.start: (?immediate_sweep: boolish, ?immediate_mark: boolish, ?full_mark: boolish) -> nil
@@ -225,79 +283,106 @@ module GC
225
283
  # -->
226
284
  # Returns a Hash containing information about the GC.
227
285
  #
228
- # The contents of the hash are implementation specific and may change in the
286
+ # The contents of the hash are implementation-specific and may change in the
229
287
  # future without notice.
230
288
  #
231
- # The hash includes information about internal statistics about GC such as:
289
+ # The hash includes internal statistics about GC such as:
232
290
  #
233
291
  # count
234
- # : The total number of garbage collections ran since application start (count
292
+ # : The total number of garbage collections run since application start (count
235
293
  # includes both minor and major garbage collections)
294
+ #
236
295
  # time
237
296
  # : The total time spent in garbage collections (in milliseconds)
297
+ #
238
298
  # heap_allocated_pages
239
299
  # : The total number of `:heap_eden_pages` + `:heap_tomb_pages`
300
+ #
240
301
  # heap_sorted_length
241
302
  # : The number of pages that can fit into the buffer that holds references to
242
303
  # all pages
304
+ #
243
305
  # heap_allocatable_pages
244
306
  # : The total number of pages the application could allocate without
245
307
  # additional GC
308
+ #
246
309
  # heap_available_slots
247
310
  # : The total number of slots in all `:heap_allocated_pages`
311
+ #
248
312
  # heap_live_slots
249
313
  # : The total number of slots which contain live objects
314
+ #
250
315
  # heap_free_slots
251
316
  # : The total number of slots which do not contain live objects
317
+ #
252
318
  # heap_final_slots
253
319
  # : The total number of slots with pending finalizers to be run
320
+ #
254
321
  # heap_marked_slots
255
322
  # : The total number of objects marked in the last GC
323
+ #
256
324
  # heap_eden_pages
257
325
  # : The total number of pages which contain at least one live slot
326
+ #
258
327
  # heap_tomb_pages
259
328
  # : The total number of pages which do not contain any live slots
329
+ #
260
330
  # total_allocated_pages
261
331
  # : The cumulative number of pages allocated since application start
332
+ #
262
333
  # total_freed_pages
263
334
  # : The cumulative number of pages freed since application start
335
+ #
264
336
  # total_allocated_objects
265
337
  # : The cumulative number of objects allocated since application start
338
+ #
266
339
  # total_freed_objects
267
340
  # : The cumulative number of objects freed since application start
341
+ #
268
342
  # malloc_increase_bytes
269
343
  # : Amount of memory allocated on the heap for objects. Decreased by any GC
344
+ #
270
345
  # malloc_increase_bytes_limit
271
346
  # : When `:malloc_increase_bytes` crosses this limit, GC is triggered
347
+ #
272
348
  # minor_gc_count
273
349
  # : The total number of minor garbage collections run since process start
350
+ #
274
351
  # major_gc_count
275
352
  # : The total number of major garbage collections run since process start
353
+ #
276
354
  # compact_count
277
355
  # : The total number of compactions run since process start
356
+ #
278
357
  # read_barrier_faults
279
358
  # : The total number of times the read barrier was triggered during compaction
359
+ #
280
360
  # total_moved_objects
281
361
  # : The total number of objects compaction has moved
362
+ #
282
363
  # remembered_wb_unprotected_objects
283
364
  # : The total number of objects without write barriers
365
+ #
284
366
  # remembered_wb_unprotected_objects_limit
285
367
  # : When `:remembered_wb_unprotected_objects` crosses this limit, major GC is
286
368
  # triggered
369
+ #
287
370
  # old_objects
288
371
  # : Number of live, old objects which have survived at least 3 garbage
289
372
  # collections
373
+ #
290
374
  # old_objects_limit
291
375
  # : When `:old_objects` crosses this limit, major GC is triggered
376
+ #
292
377
  # oldmalloc_increase_bytes
293
378
  # : Amount of memory allocated on the heap for objects. Decreased by major GC
379
+ #
294
380
  # oldmalloc_increase_bytes_limit
295
- # : When `:old_malloc_increase_bytes` crosses this limit, major GC is
296
- # triggered
381
+ # : When `:oldmalloc_increase_bytes` crosses this limit, major GC is triggered
297
382
  #
298
383
  #
299
384
  # If the optional argument, hash, is given, it is overwritten and returned. This
300
- # is intended to avoid probe effect.
385
+ # is intended to avoid the probe effect.
301
386
  #
302
387
  # This method is only expected to work on CRuby.
303
388
  #
@@ -308,7 +393,7 @@ module GC
308
393
  # rdoc-file=gc.rb
309
394
  # - GC.measure_total_time = true/false
310
395
  # -->
311
- # Enable to measure GC time. You can get the result with `GC.stat(:time)`. Note
396
+ # Enables measuring GC time. You can get the result with `GC.stat(:time)`. Note
312
397
  # that GC time measurement can cause some performance overhead.
313
398
  #
314
399
  def self.measure_total_time=: [T] (T enable) -> T
@@ -317,8 +402,8 @@ module GC
317
402
  # rdoc-file=gc.rb
318
403
  # - GC.measure_total_time -> true/false
319
404
  # -->
320
- # Return measure_total_time flag (default: `true`). Note that measurement can
321
- # affect the application performance.
405
+ # Returns the measure_total_time flag (default: `true`). Note that measurement
406
+ # can affect the application's performance.
322
407
  #
323
408
  def self.measure_total_time: () -> bool
324
409
 
@@ -357,16 +442,16 @@ module GC
357
442
  # it will return a `Hash` with heap names as keys and a `Hash` containing
358
443
  # information about the heap as values.
359
444
  #
360
- # If the second optional argument, `hash_or_key`, is given as `Hash`, it will be
361
- # overwritten and returned. This is intended to avoid the probe effect.
445
+ # If the second optional argument, `hash_or_key`, is given as a `Hash`, it will
446
+ # be overwritten and returned. This is intended to avoid the probe effect.
362
447
  #
363
448
  # If both optional arguments are passed in and the second optional argument is a
364
- # symbol, it will return a `Numeric` of the value for the particular heap.
449
+ # symbol, it will return a `Numeric` value for the particular heap.
365
450
  #
366
451
  # On CRuby, `heap_name` is of the type `Integer` but may be of type `String` on
367
452
  # other implementations.
368
453
  #
369
- # The contents of the hash are implementation specific and may change in the
454
+ # The contents of the hash are implementation-specific and may change in the
370
455
  # future without notice.
371
456
  #
372
457
  # If the optional argument, hash, is given, it is overwritten and returned.
@@ -377,26 +462,35 @@ module GC
377
462
  #
378
463
  # slot_size
379
464
  # : The slot size of the heap in bytes.
465
+ #
380
466
  # heap_allocatable_pages
381
467
  # : The number of pages that can be allocated without triggering a new garbage
382
468
  # collection cycle.
469
+ #
383
470
  # heap_eden_pages
384
471
  # : The number of pages in the eden heap.
472
+ #
385
473
  # heap_eden_slots
386
474
  # : The total number of slots in all of the pages in the eden heap.
475
+ #
387
476
  # heap_tomb_pages
388
477
  # : The number of pages in the tomb heap. The tomb heap only contains pages
389
478
  # that do not have any live objects.
479
+ #
390
480
  # heap_tomb_slots
391
481
  # : The total number of slots in all of the pages in the tomb heap.
482
+ #
392
483
  # total_allocated_pages
393
484
  # : The total number of pages that have been allocated in the heap.
485
+ #
394
486
  # total_freed_pages
395
487
  # : The total number of pages that have been freed and released back to the
396
488
  # system in the heap.
489
+ #
397
490
  # force_major_gc_count
398
- # : The number of times major garbage collection cycles this heap has forced
491
+ # : The number of times this heap has forced major garbage collection cycles
399
492
  # to start due to running out of free slots.
493
+ #
400
494
  # force_incremental_marking_finish_count
401
495
  # : The number of times this heap has forced incremental marking to complete
402
496
  # due to running out of pooled slots.
@@ -420,24 +514,25 @@ module GC
420
514
 
421
515
  # <!--
422
516
  # rdoc-file=gc.rb
423
- # - GC.stress -> integer, true or false
517
+ # - GC.stress -> integer, true, or false
424
518
  # -->
425
- # Returns current status of GC stress mode.
519
+ # Returns the current status of GC stress mode.
426
520
  #
427
521
  def self.stress: () -> (Integer | bool)
428
522
 
429
523
  # <!--
430
524
  # rdoc-file=gc.rb
431
- # - GC.stress = flag -> flag
525
+ # - GC.stress = flag -> flag
432
526
  # -->
433
527
  # Updates the GC stress mode.
434
528
  #
435
529
  # When stress mode is enabled, the GC is invoked at every GC opportunity: all
436
530
  # memory and object allocations.
437
531
  #
438
- # Enabling stress mode will degrade performance, it is only for debugging.
532
+ # Enabling stress mode will degrade performance; it is only for debugging.
439
533
  #
440
- # flag can be true, false, or an integer bit-ORed following flags.
534
+ # The flag can be true, false, or an integer bitwise-ORed with the following
535
+ # flags:
441
536
  # 0x01:: no major GC
442
537
  # 0x02:: no immediate sweep
443
538
  # 0x04:: full mark after malloc/calloc/realloc
@@ -449,7 +544,7 @@ module GC
449
544
  # rdoc-file=gc.rb
450
545
  # - GC.total_time -> int
451
546
  # -->
452
- # Return measured GC total time in nano seconds.
547
+ # Returns the measured GC total time in nanoseconds.
453
548
  #
454
549
  def self.total_time: () -> Integer
455
550
 
@@ -508,12 +603,15 @@ module GC
508
603
  # rdoc-file=gc.rb
509
604
  # - GC.latest_gc_info -> hash
510
605
  # - GC.latest_gc_info(hash) -> hash
511
- # - GC.latest_gc_info(:major_by) -> :malloc
606
+ # - GC.latest_gc_info(key) -> value
512
607
  # -->
513
608
  # Returns information about the most recent garbage collection.
514
609
  #
515
- # If the optional argument, hash, is given, it is overwritten and returned. This
516
- # is intended to avoid probe effect.
610
+ # If the argument `hash` is given and is a Hash object, it is overwritten and
611
+ # returned. This is intended to avoid the probe effect.
612
+ #
613
+ # If the argument `key` is given and is a Symbol object, it returns the value
614
+ # associated with the key. This is equivalent to `GC.latest_gc_info[key]`.
517
615
  #
518
616
  def self.latest_gc_info: (?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
519
617
  | (Symbol key) -> untyped