rbs 3.10.0 → 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 +11 -0
- data/core/array.rbs +5 -9
- data/core/comparable.rbs +13 -6
- data/core/complex.rbs +8 -4
- data/core/dir.rbs +2 -2
- data/core/enumerator.rbs +25 -0
- data/core/fiber.rbs +24 -16
- data/core/file.rbs +22 -7
- data/core/float.rbs +15 -11
- data/core/hash.rbs +5 -6
- data/core/integer.rbs +26 -25
- data/core/io/buffer.rbs +3 -3
- data/core/kernel.rbs +4 -0
- data/core/method.rbs +49 -19
- data/core/module.rbs +18 -11
- data/core/numeric.rbs +9 -1
- data/core/pathname.rbs +0 -34
- data/core/proc.rbs +15 -16
- data/core/ractor.rbs +155 -144
- data/core/rational.rbs +19 -10
- data/core/set.rbs +2 -2
- data/core/signal.rbs +24 -14
- data/core/string.rbs +34 -30
- data/core/symbol.rbs +13 -7
- data/core/thread.rbs +3 -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/version.rb +1 -1
- data/stdlib/cgi/0/core.rbs +11 -1
- data/stdlib/cgi-escape/0/escape.rbs +33 -15
- data/stdlib/pathname/0/pathname.rbs +36 -0
- metadata +3 -2
data/core/method.rbs
CHANGED
|
@@ -126,7 +126,9 @@ class Method
|
|
|
126
126
|
|
|
127
127
|
# <!--
|
|
128
128
|
# rdoc-file=proc.c
|
|
129
|
-
# - meth.call(args, ...)
|
|
129
|
+
# - meth.call(args, ...) -> obj
|
|
130
|
+
# - meth[args, ...] -> obj
|
|
131
|
+
# - method === obj -> result_of_method
|
|
130
132
|
# -->
|
|
131
133
|
# Invokes the *meth* with the specified arguments, returning the method's return
|
|
132
134
|
# value.
|
|
@@ -135,23 +137,32 @@ class Method
|
|
|
135
137
|
# m.call(3) #=> 15
|
|
136
138
|
# m.call(20) #=> 32
|
|
137
139
|
#
|
|
140
|
+
# Using Method#=== allows a method object to be the target of a `when` clause in
|
|
141
|
+
# a case statement.
|
|
142
|
+
#
|
|
143
|
+
# require 'prime'
|
|
144
|
+
#
|
|
145
|
+
# case 1373
|
|
146
|
+
# when Prime.method(:prime?)
|
|
147
|
+
# # ...
|
|
148
|
+
# end
|
|
149
|
+
#
|
|
138
150
|
def call: (?) -> untyped
|
|
139
151
|
|
|
140
152
|
# <!--
|
|
141
153
|
# rdoc-file=proc.c
|
|
142
|
-
# -
|
|
154
|
+
# - self << g -> a_proc
|
|
143
155
|
# -->
|
|
144
|
-
# Returns a proc that is the composition of
|
|
145
|
-
# returned proc takes a variable number of arguments, calls *g* with them then
|
|
146
|
-
# calls this method with the result.
|
|
156
|
+
# Returns a proc that is the composition of the given `g` and this method.
|
|
147
157
|
#
|
|
148
|
-
#
|
|
149
|
-
#
|
|
150
|
-
#
|
|
158
|
+
# The returned proc takes a variable number of arguments. It first calls `g`
|
|
159
|
+
# with the arguments, then calls `self` with the return value of `g`.
|
|
160
|
+
#
|
|
161
|
+
# def f(ary) = ary << 'in f'
|
|
151
162
|
#
|
|
152
163
|
# f = self.method(:f)
|
|
153
|
-
# g = proc {|
|
|
154
|
-
#
|
|
164
|
+
# g = proc { |ary| ary << 'in proc' }
|
|
165
|
+
# (f << g).call([]) # => ["in proc", "in f"]
|
|
155
166
|
#
|
|
156
167
|
def <<: (Proc::_Callable g) -> Proc
|
|
157
168
|
|
|
@@ -163,23 +174,32 @@ class Method
|
|
|
163
174
|
# m.call(3) #=> 15
|
|
164
175
|
# m.call(20) #=> 32
|
|
165
176
|
#
|
|
177
|
+
# Using Method#=== allows a method object to be the target of a `when` clause in
|
|
178
|
+
# a case statement.
|
|
179
|
+
#
|
|
180
|
+
# require 'prime'
|
|
181
|
+
#
|
|
182
|
+
# case 1373
|
|
183
|
+
# when Prime.method(:prime?)
|
|
184
|
+
# # ...
|
|
185
|
+
# end
|
|
186
|
+
#
|
|
166
187
|
alias === call
|
|
167
188
|
|
|
168
189
|
# <!--
|
|
169
190
|
# rdoc-file=proc.c
|
|
170
|
-
# -
|
|
191
|
+
# - self >> g -> a_proc
|
|
171
192
|
# -->
|
|
172
|
-
# Returns a proc that is the composition of this method and the given
|
|
173
|
-
# returned proc takes a variable number of arguments, calls this method with
|
|
174
|
-
# them then calls *g* with the result.
|
|
193
|
+
# Returns a proc that is the composition of this method and the given `g`.
|
|
175
194
|
#
|
|
176
|
-
#
|
|
177
|
-
#
|
|
178
|
-
#
|
|
195
|
+
# The returned proc takes a variable number of arguments. It first calls `self`
|
|
196
|
+
# with the arguments, then calls `g` with the return value of `self`.
|
|
197
|
+
#
|
|
198
|
+
# def f(ary) = ary << 'in f'
|
|
179
199
|
#
|
|
180
200
|
# f = self.method(:f)
|
|
181
|
-
# g = proc {|
|
|
182
|
-
#
|
|
201
|
+
# g = proc { |ary| ary << 'in proc' }
|
|
202
|
+
# (f >> g).call([]) # => ["in f", "in proc"]
|
|
183
203
|
#
|
|
184
204
|
def >>: (Proc::_Callable g) -> Proc
|
|
185
205
|
|
|
@@ -191,6 +211,16 @@ class Method
|
|
|
191
211
|
# m.call(3) #=> 15
|
|
192
212
|
# m.call(20) #=> 32
|
|
193
213
|
#
|
|
214
|
+
# Using Method#=== allows a method object to be the target of a `when` clause in
|
|
215
|
+
# a case statement.
|
|
216
|
+
#
|
|
217
|
+
# require 'prime'
|
|
218
|
+
#
|
|
219
|
+
# case 1373
|
|
220
|
+
# when Prime.method(:prime?)
|
|
221
|
+
# # ...
|
|
222
|
+
# end
|
|
223
|
+
#
|
|
194
224
|
alias [] call
|
|
195
225
|
|
|
196
226
|
# <!--
|
data/core/module.rbs
CHANGED
|
@@ -114,12 +114,15 @@ class Module < Object
|
|
|
114
114
|
|
|
115
115
|
# <!--
|
|
116
116
|
# rdoc-file=object.c
|
|
117
|
-
# -
|
|
117
|
+
# - self < other -> true, false, or nil
|
|
118
118
|
# -->
|
|
119
|
-
# Returns
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
#
|
|
119
|
+
# Returns whether `self` is a subclass of `other`, or `nil` if there is no
|
|
120
|
+
# relationship between the two:
|
|
121
|
+
#
|
|
122
|
+
# Float < Numeric # => true
|
|
123
|
+
# Numeric < Float # => false
|
|
124
|
+
# Float < Float # => false
|
|
125
|
+
# Float < Hash # => nil
|
|
123
126
|
#
|
|
124
127
|
def <: (Module other) -> bool?
|
|
125
128
|
|
|
@@ -135,13 +138,15 @@ class Module < Object
|
|
|
135
138
|
|
|
136
139
|
# <!--
|
|
137
140
|
# rdoc-file=object.c
|
|
138
|
-
# - self <=>
|
|
141
|
+
# - self <=> other -> -1, 0, 1, or nil
|
|
139
142
|
# -->
|
|
143
|
+
# Compares `self` and `other`.
|
|
144
|
+
#
|
|
140
145
|
# Returns:
|
|
141
146
|
#
|
|
142
|
-
# * `-1`, if `self` includes `
|
|
143
|
-
# * `0`, if `self` and `
|
|
144
|
-
# * `1`, if `
|
|
147
|
+
# * `-1`, if `self` includes `other`, if or `self` is a subclass of `other`.
|
|
148
|
+
# * `0`, if `self` and `other` are the same.
|
|
149
|
+
# * `1`, if `other` includes `self`, or if `other` is a subclass of `self`.
|
|
145
150
|
# * `nil`, if none of the above is true.
|
|
146
151
|
#
|
|
147
152
|
# Examples:
|
|
@@ -152,8 +157,10 @@ class Module < Object
|
|
|
152
157
|
# Enumerable <=> Array # => 1
|
|
153
158
|
# # Class File is a subclass of class IO.
|
|
154
159
|
# File <=> IO # => -1
|
|
155
|
-
# IO <=> File # => 1
|
|
156
160
|
# File <=> File # => 0
|
|
161
|
+
# IO <=> File # => 1
|
|
162
|
+
# # Class File has no relationship to class String.
|
|
163
|
+
# File <=> String # => nil
|
|
157
164
|
#
|
|
158
165
|
def <=>: (untyped other) -> Integer?
|
|
159
166
|
|
|
@@ -1649,7 +1656,7 @@ class Module < Object
|
|
|
1649
1656
|
# m.name #=> nil
|
|
1650
1657
|
#
|
|
1651
1658
|
# c = Class.new
|
|
1652
|
-
# c.set_temporary_name("MyClass(with description)")
|
|
1659
|
+
# c.set_temporary_name("MyClass(with description)") # => MyClass(with description)
|
|
1653
1660
|
#
|
|
1654
1661
|
# c.new # => #<MyClass(with description):0x0....>
|
|
1655
1662
|
#
|
data/core/numeric.rbs
CHANGED
|
@@ -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
|
#
|
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, ...)
|
|
@@ -1017,18 +995,6 @@ class Pathname
|
|
|
1017
995
|
#
|
|
1018
996
|
def rmdir: () -> 0
|
|
1019
997
|
|
|
1020
|
-
# <!--
|
|
1021
|
-
# rdoc-file=lib/pathname.rb
|
|
1022
|
-
# - rmtree(noop: nil, verbose: nil, secure: nil)
|
|
1023
|
-
# -->
|
|
1024
|
-
# Recursively deletes a directory, including all directories beneath it.
|
|
1025
|
-
#
|
|
1026
|
-
# Note that you need to require 'pathname' to use this method.
|
|
1027
|
-
#
|
|
1028
|
-
# See FileUtils.rm_rf
|
|
1029
|
-
#
|
|
1030
|
-
def rmtree: () -> self
|
|
1031
|
-
|
|
1032
998
|
# <!--
|
|
1033
999
|
# rdoc-file=pathname_builtin.rb
|
|
1034
1000
|
# - root?()
|
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]
|