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.
- checksums.yaml +4 -4
- data/.github/workflows/c-check.yml +1 -1
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +7 -8
- data/CHANGELOG.md +60 -0
- data/core/array.rbs +52 -3
- data/core/comparable.rbs +13 -6
- data/core/complex.rbs +40 -25
- data/core/dir.rbs +2 -2
- data/core/encoding.rbs +3 -7
- data/core/enumerable.rbs +1 -1
- data/core/enumerator.rbs +43 -1
- data/core/fiber.rbs +26 -17
- data/core/file.rbs +23 -8
- data/core/file_test.rbs +1 -1
- data/core/float.rbs +223 -32
- data/core/gc.rbs +4 -9
- data/core/hash.rbs +9 -10
- data/core/integer.rbs +104 -63
- data/core/io/buffer.rbs +21 -10
- data/core/io.rbs +8 -8
- data/core/kernel.rbs +12 -8
- data/core/method.rbs +49 -19
- data/core/module.rbs +30 -12
- data/core/numeric.rbs +17 -9
- data/core/object_space.rbs +13 -20
- data/core/pathname.rbs +2 -37
- data/core/proc.rbs +15 -16
- data/core/ractor.rbs +156 -145
- data/core/range.rbs +1 -1
- data/core/rational.rbs +56 -34
- data/core/rbs/unnamed/argf.rbs +1 -1
- data/core/regexp.rbs +3 -3
- data/core/ruby.rbs +53 -0
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +88 -66
- data/core/signal.rbs +24 -14
- data/core/string.rbs +304 -166
- data/core/symbol.rbs +13 -7
- data/core/thread.rbs +12 -13
- data/core/trace_point.rbs +7 -4
- data/lib/rbs/collection/config/lockfile_generator.rb +7 -0
- data/lib/rbs/environment_loader.rb +0 -6
- data/lib/rbs/subtractor.rb +3 -1
- data/lib/rbs/test/type_check.rb +1 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rdoc/discover.rb +1 -1
- 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 +11 -1
- data/stdlib/cgi-escape/0/escape.rbs +33 -15
- data/stdlib/date/0/date.rbs +67 -59
- data/stdlib/date/0/date_time.rbs +1 -1
- data/stdlib/json/0/json.rbs +1 -0
- data/stdlib/objspace/0/objspace.rbs +1 -1
- data/stdlib/openssl/0/openssl.rbs +150 -80
- data/stdlib/pathname/0/pathname.rbs +36 -0
- data/stdlib/psych/0/psych.rbs +3 -3
- data/stdlib/stringio/0/stringio.rbs +796 -37
- data/stdlib/strscan/0/string_scanner.rbs +1 -1
- data/stdlib/tempfile/0/tempfile.rbs +2 -2
- data/stdlib/time/0/time.rbs +1 -1
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/uri/0/generic.rbs +1 -1
- 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
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
|
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 `/`
|
|
402
|
-
#
|
|
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
|
|
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
|
|
769
|
-
#
|
|
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.
|
data/core/object_space.rbs
CHANGED
|
@@ -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`,
|
|
141
|
-
# `nil`) are never returned.
|
|
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
|
-
#
|
|
147
|
-
#
|
|
148
|
-
#
|
|
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
|
-
#
|
|
155
|
-
#
|
|
156
|
-
#
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
#
|
|
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=
|
|
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
|
|
384
|
-
#
|
|
385
|
-
#
|
|
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
|
|
413
|
-
#
|
|
414
|
-
#
|
|
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
|
-
# -
|
|
596
|
-
# -
|
|
597
|
-
# -
|
|
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
|
|
601
|
-
#
|
|
602
|
-
#
|
|
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
|
|
630
|
-
#
|
|
631
|
-
#
|
|
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]
|