rbs 3.10.0.pre.2 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/c-check.yml +1 -1
  3. data/.github/workflows/comments.yml +3 -3
  4. data/.github/workflows/ruby.yml +7 -8
  5. data/CHANGELOG.md +60 -0
  6. data/core/array.rbs +52 -3
  7. data/core/comparable.rbs +13 -6
  8. data/core/complex.rbs +40 -25
  9. data/core/dir.rbs +2 -2
  10. data/core/encoding.rbs +3 -7
  11. data/core/enumerable.rbs +1 -1
  12. data/core/enumerator.rbs +43 -1
  13. data/core/fiber.rbs +26 -17
  14. data/core/file.rbs +23 -8
  15. data/core/file_test.rbs +1 -1
  16. data/core/float.rbs +223 -32
  17. data/core/gc.rbs +4 -9
  18. data/core/hash.rbs +9 -10
  19. data/core/integer.rbs +104 -63
  20. data/core/io/buffer.rbs +21 -10
  21. data/core/io.rbs +8 -8
  22. data/core/kernel.rbs +12 -8
  23. data/core/method.rbs +49 -19
  24. data/core/module.rbs +30 -12
  25. data/core/numeric.rbs +17 -9
  26. data/core/object_space.rbs +13 -20
  27. data/core/pathname.rbs +2 -37
  28. data/core/proc.rbs +15 -16
  29. data/core/ractor.rbs +156 -145
  30. data/core/range.rbs +1 -1
  31. data/core/rational.rbs +56 -34
  32. data/core/rbs/unnamed/argf.rbs +1 -1
  33. data/core/regexp.rbs +3 -3
  34. data/core/ruby.rbs +53 -0
  35. data/core/rubygems/version.rbs +2 -3
  36. data/core/set.rbs +88 -66
  37. data/core/signal.rbs +24 -14
  38. data/core/string.rbs +304 -166
  39. data/core/symbol.rbs +13 -7
  40. data/core/thread.rbs +12 -13
  41. data/core/trace_point.rbs +7 -4
  42. data/lib/rbs/collection/config/lockfile_generator.rb +7 -0
  43. data/lib/rbs/environment_loader.rb +0 -6
  44. data/lib/rbs/subtractor.rb +3 -1
  45. data/lib/rbs/test/type_check.rb +1 -0
  46. data/lib/rbs/version.rb +1 -1
  47. data/lib/rdoc/discover.rb +1 -1
  48. data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
  49. data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
  50. data/stdlib/cgi/0/core.rbs +11 -1
  51. data/stdlib/cgi-escape/0/escape.rbs +33 -15
  52. data/stdlib/date/0/date.rbs +67 -59
  53. data/stdlib/date/0/date_time.rbs +1 -1
  54. data/stdlib/json/0/json.rbs +1 -0
  55. data/stdlib/objspace/0/objspace.rbs +1 -1
  56. data/stdlib/openssl/0/openssl.rbs +150 -80
  57. data/stdlib/pathname/0/pathname.rbs +36 -0
  58. data/stdlib/psych/0/psych.rbs +3 -3
  59. data/stdlib/stringio/0/stringio.rbs +796 -37
  60. data/stdlib/strscan/0/string_scanner.rbs +1 -1
  61. data/stdlib/tempfile/0/tempfile.rbs +2 -2
  62. data/stdlib/time/0/time.rbs +1 -1
  63. data/stdlib/timeout/0/timeout.rbs +63 -7
  64. data/stdlib/uri/0/generic.rbs +1 -1
  65. metadata +4 -2
data/core/numeric.rbs CHANGED
@@ -160,7 +160,7 @@ class Numeric
160
160
  # rdoc-file=numeric.c
161
161
  # - self % other -> real_numeric
162
162
  # -->
163
- # Returns `self` modulo `other` as a real number.
163
+ # Returns `self` modulo `other` as a real numeric (Integer, Float, or Rational).
164
164
  #
165
165
  # Of the Core and Standard Library classes, only Rational uses this
166
166
  # implementation.
@@ -212,7 +212,7 @@ class Numeric
212
212
  # rdoc-file=numeric.c
213
213
  # - -self -> numeric
214
214
  # -->
215
- # Unary Minus---Returns the receiver, negated.
215
+ # Returns `self`, negated.
216
216
  #
217
217
  def -@: () -> Numeric
218
218
 
@@ -220,7 +220,15 @@ class Numeric
220
220
  # rdoc-file=numeric.c
221
221
  # - self <=> other -> zero or nil
222
222
  # -->
223
- # Returns zero if `self` is the same as `other`, `nil` otherwise.
223
+ # Compares `self` and `other`.
224
+ #
225
+ # Returns:
226
+ #
227
+ # * Zero, if `self` is the same as `other`.
228
+ # * `nil`, otherwise.
229
+ #
230
+ # Class Numeric includes module Comparable, each of whose methods uses
231
+ # Numeric#<=> for comparison.
224
232
  #
225
233
  # No subclass in the Ruby Core or Standard Library uses this implementation.
226
234
  #
@@ -336,7 +344,7 @@ class Numeric
336
344
  # - div(other) -> integer
337
345
  # -->
338
346
  # Returns the quotient `self/other` as an integer (via `floor`), using method
339
- # `/` in the derived class of `self`. (Numeric itself does not define method
347
+ # `/` as defined in the subclass of Numeric. (Numeric itself does not define
340
348
  # `/`.)
341
349
  #
342
350
  # Of the Core and Standard Library classes, Only Float and Rational use this
@@ -398,8 +406,8 @@ class Numeric
398
406
  # rdoc-file=numeric.c
399
407
  # - fdiv(other) -> float
400
408
  # -->
401
- # Returns the quotient `self/other` as a float, using method `/` in the derived
402
- # class of `self`. (Numeric itself does not define method `/`.)
409
+ # Returns the quotient `self/other` as a float, using method `/` as defined in
410
+ # the subclass of Numeric. (Numeric itself does not define `/`.)
403
411
  #
404
412
  # Of the Core and Standard Library classes, only BigDecimal uses this
405
413
  # implementation.
@@ -488,7 +496,7 @@ class Numeric
488
496
  alias magnitude abs
489
497
 
490
498
  # <!-- rdoc-file=numeric.c -->
491
- # Returns `self` modulo `other` as a real number.
499
+ # Returns `self` modulo `other` as a real numeric (Integer, Float, or Rational).
492
500
  #
493
501
  # Of the Core and Standard Library classes, only Rational uses this
494
502
  # implementation.
@@ -765,8 +773,8 @@ class Numeric
765
773
  # rdoc-file=numeric.c
766
774
  # - to_int -> integer
767
775
  # -->
768
- # Returns `self` as an integer; converts using method `to_i` in the derived
769
- # class.
776
+ # Returns `self` as an integer; converts using method `to_i` in the subclass of
777
+ # Numeric. (Numeric itself does not define `to_i`.)
770
778
  #
771
779
  # Of the Core and Standard Library classes, only Rational and Complex use this
772
780
  # implementation.
@@ -137,33 +137,26 @@ module ObjectSpace
137
137
  # Calls the block once for each living, nonimmediate object in this Ruby
138
138
  # process. If *module* is specified, calls the block for only those classes or
139
139
  # modules that match (or are a subclass of) *module*. Returns the number of
140
- # objects found. Immediate objects (`Fixnum`s, `Symbol`s `true`, `false`, and
141
- # `nil`) are never returned. In the example below, #each_object returns both the
142
- # numbers we defined and several constants defined in the Math module.
140
+ # objects found. Immediate objects (such as `Fixnum`s, static `Symbol`s `true`,
141
+ # `false` and `nil`) are never returned.
143
142
  #
144
143
  # If no block is given, an enumerator is returned instead.
145
144
  #
146
- # a = 102.7
147
- # b = 95 # Won't be returned
148
- # c = 12345678987654321
149
- # count = ObjectSpace.each_object(Numeric) {|x| p x }
145
+ # Job = Class.new
146
+ # jobs = [Job.new, Job.new]
147
+ # count = ObjectSpace.each_object(Job) {|x| p x }
150
148
  # puts "Total count: #{count}"
151
149
  #
152
150
  # *produces:*
153
151
  #
154
- # 12345678987654321
155
- # 102.7
156
- # 2.71828182845905
157
- # 3.14159265358979
158
- # 2.22044604925031e-16
159
- # 1.7976931348623157e+308
160
- # 2.2250738585072e-308
161
- # Total count: 7
162
- #
163
- # Due to a current known Ractor implementation issue, this method will not yield
164
- # Ractor-unshareable objects in multi-Ractor mode (when `Ractor.new` has been
165
- # called within the process at least once). See
166
- # https://bugs.ruby-lang.org/issues/19387 for more information.
152
+ # #<Job:0x000000011d6cbbf0>
153
+ # #<Job:0x000000011d6cbc68>
154
+ # Total count: 2
155
+ #
156
+ # Due to a current Ractor implementation issue, this method does not yield
157
+ # Ractor-unshareable objects when the process is in multi-Ractor mode.
158
+ # Multi-ractor mode is enabled when `Ractor.new` has been called for the first
159
+ # time. See https://bugs.ruby-lang.org/issues/19387 for more information.
167
160
  #
168
161
  # a = 12345678987654321 # shareable
169
162
  # b = [].freeze # shareable
data/core/pathname.rbs CHANGED
@@ -670,28 +670,6 @@ class Pathname
670
670
  #
671
671
  def file?: () -> bool
672
672
 
673
- # <!--
674
- # rdoc-file=lib/pathname.rb
675
- # - find(ignore_error: true) { |pathname| ... }
676
- # -->
677
- # Iterates over the directory tree in a depth first manner, yielding a Pathname
678
- # for each file under "this" directory.
679
- #
680
- # Note that you need to require 'pathname' to use this method.
681
- #
682
- # Returns an Enumerator if no block is given.
683
- #
684
- # Since it is implemented by the standard library module Find, Find.prune can be
685
- # used to control the traversal.
686
- #
687
- # If `self` is `.`, yielded pathnames begin with a filename in the current
688
- # directory, not `./`.
689
- #
690
- # See Find.find
691
- #
692
- def find: (?ignore_error: boolish) { (Pathname) -> untyped } -> nil
693
- | (?ignore_error: boolish) -> Enumerator[Pathname, nil]
694
-
695
673
  # <!--
696
674
  # rdoc-file=pathname_builtin.rb
697
675
  # - fnmatch(pattern, ...)
@@ -712,6 +690,7 @@ class Pathname
712
690
  # rdoc-file=pathname_builtin.rb
713
691
  # - freeze()
714
692
  # -->
693
+ # Freze self.
715
694
  #
716
695
  def freeze: () -> Pathname
717
696
 
@@ -1016,18 +995,6 @@ class Pathname
1016
995
  #
1017
996
  def rmdir: () -> 0
1018
997
 
1019
- # <!--
1020
- # rdoc-file=lib/pathname.rb
1021
- # - rmtree(noop: nil, verbose: nil, secure: nil)
1022
- # -->
1023
- # Recursively deletes a directory, including all directories beneath it.
1024
- #
1025
- # Note that you need to require 'pathname' to use this method.
1026
- #
1027
- # See FileUtils.rm_rf
1028
- #
1029
- def rmtree: () -> self
1030
-
1031
998
  # <!--
1032
999
  # rdoc-file=pathname_builtin.rb
1033
1000
  # - root?()
@@ -1154,9 +1121,7 @@ class Pathname
1154
1121
  #
1155
1122
  def taint: () -> Pathname
1156
1123
 
1157
- # <!-- rdoc-file=ext/pathname/pathname.c -->
1158
- # Return the path as a String.
1159
- #
1124
+ # <!-- rdoc-file=pathname_builtin.rb -->
1160
1125
  # to_path is implemented so Pathname objects are usable with File.open, etc.
1161
1126
  #
1162
1127
  def to_path: () -> String
data/core/proc.rbs CHANGED
@@ -380,9 +380,9 @@ class Proc
380
380
  def dup: () -> self
381
381
 
382
382
  # <!-- rdoc-file=proc.c -->
383
- # Invokes the block, setting the block's parameters to the values in *params*
384
- # using something close to method calling semantics. Returns the value of the
385
- # last expression evaluated in the block.
383
+ # Invokes the block, setting the block's parameters to the arguments using
384
+ # something close to method calling semantics. Returns the value of the last
385
+ # expression evaluated in the block.
386
386
  #
387
387
  # a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
388
388
  # a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
@@ -409,9 +409,9 @@ class Proc
409
409
  alias === call
410
410
 
411
411
  # <!-- rdoc-file=proc.c -->
412
- # Invokes the block, setting the block's parameters to the values in *params*
413
- # using something close to method calling semantics. Returns the value of the
414
- # last expression evaluated in the block.
412
+ # Invokes the block, setting the block's parameters to the arguments using
413
+ # something close to method calling semantics. Returns the value of the last
414
+ # expression evaluated in the block.
415
415
  #
416
416
  # a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
417
417
  # a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
@@ -592,14 +592,13 @@ class Proc
592
592
 
593
593
  # <!--
594
594
  # rdoc-file=proc.c
595
- # - prc.call(params,...) -> obj
596
- # - prc[params,...] -> obj
597
- # - prc.(params,...) -> obj
598
- # - prc.yield(params,...) -> obj
595
+ # - call(...) -> obj
596
+ # - self[...] -> obj
597
+ # - yield(...) -> obj
599
598
  # -->
600
- # Invokes the block, setting the block's parameters to the values in *params*
601
- # using something close to method calling semantics. Returns the value of the
602
- # last expression evaluated in the block.
599
+ # Invokes the block, setting the block's parameters to the arguments using
600
+ # something close to method calling semantics. Returns the value of the last
601
+ # expression evaluated in the block.
603
602
  #
604
603
  # a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
605
604
  # a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]
@@ -626,9 +625,9 @@ class Proc
626
625
  def call: (?) -> untyped
627
626
 
628
627
  # <!-- rdoc-file=proc.c -->
629
- # Invokes the block, setting the block's parameters to the values in *params*
630
- # using something close to method calling semantics. Returns the value of the
631
- # last expression evaluated in the block.
628
+ # Invokes the block, setting the block's parameters to the arguments using
629
+ # something close to method calling semantics. Returns the value of the last
630
+ # expression evaluated in the block.
632
631
  #
633
632
  # a_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } }
634
633
  # a_proc.call(9, 1, 2, 3) #=> [9, 18, 27]