rbs 3.0.0.dev.2 → 3.0.0.dev.3
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/comments.yml +2 -1
- data/.github/workflows/ruby.yml +4 -0
- data/Gemfile.lock +11 -11
- data/Rakefile +2 -2
- data/Steepfile +1 -1
- data/core/array.rbs +573 -423
- data/core/basic_object.rbs +11 -39
- data/core/binding.rbs +1 -1
- data/core/builtin.rbs +8 -0
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +7 -18
- data/core/complex.rbs +2 -2
- data/core/data.rbs +419 -0
- data/core/dir.rbs +52 -104
- data/core/encoding.rbs +22 -181
- data/core/enumerable.rbs +212 -175
- data/core/enumerator/product.rbs +96 -0
- data/core/enumerator.rbs +57 -8
- data/core/errors.rbs +8 -2
- data/core/exception.rbs +41 -0
- data/core/fiber.rbs +95 -12
- data/core/file.rbs +840 -275
- data/core/file_test.rbs +34 -19
- data/core/float.rbs +40 -96
- data/core/gc.rbs +15 -3
- data/core/hash.rbs +113 -175
- data/core/integer.rbs +85 -145
- data/core/io/buffer.rbs +187 -60
- data/core/io/wait.rbs +28 -16
- data/core/io.rbs +1859 -1389
- data/core/kernel.rbs +525 -961
- data/core/match_data.rbs +306 -142
- data/core/math.rbs +506 -234
- data/core/method.rbs +0 -24
- data/core/module.rbs +110 -17
- data/core/nil_class.rbs +2 -0
- data/core/numeric.rbs +76 -144
- data/core/object.rbs +88 -212
- data/core/proc.rbs +17 -5
- data/core/process.rbs +22 -5
- data/core/ractor.rbs +1 -1
- data/core/random.rbs +20 -3
- data/core/range.rbs +91 -89
- data/core/rational.rbs +2 -3
- data/core/rbs/unnamed/argf.rbs +177 -120
- data/core/rbs/unnamed/env_class.rbs +89 -163
- data/core/rbs/unnamed/random.rbs +36 -12
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +462 -272
- data/core/ruby_vm.rbs +210 -0
- data/{stdlib/set/0 → core}/set.rbs +43 -47
- data/core/string.rbs +1403 -1332
- data/core/string_io.rbs +191 -107
- data/core/struct.rbs +67 -63
- data/core/symbol.rbs +187 -201
- data/core/thread.rbs +40 -35
- data/core/time.rbs +902 -826
- data/core/trace_point.rbs +55 -6
- data/core/unbound_method.rbs +48 -24
- data/docs/collection.md +4 -0
- data/docs/syntax.md +55 -0
- data/ext/rbs_extension/parser.c +5 -6
- data/lib/rbs/cli.rb +6 -1
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +3 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
- data/lib/rbs/collection/config.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +9 -2
- data/lib/rbs/collection/sources/local.rb +79 -0
- data/lib/rbs/collection/sources.rb +8 -1
- data/lib/rbs/environment.rb +6 -5
- data/lib/rbs/environment_loader.rb +3 -2
- data/lib/rbs/errors.rb +18 -0
- data/lib/rbs/locator.rb +26 -7
- data/lib/rbs/sorter.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/collection/sources.rbs +32 -3
- data/sig/environment.rbs +2 -3
- data/sig/locator.rbs +14 -2
- data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
- data/stdlib/cgi/0/core.rbs +16 -0
- data/stdlib/coverage/0/coverage.rbs +50 -8
- data/stdlib/csv/0/csv.rbs +1 -1
- data/stdlib/date/0/date.rbs +856 -726
- data/stdlib/date/0/date_time.rbs +83 -210
- data/stdlib/erb/0/erb.rbs +13 -36
- data/stdlib/etc/0/etc.rbs +127 -20
- data/stdlib/fileutils/0/fileutils.rbs +1290 -381
- data/stdlib/logger/0/logger.rbs +466 -316
- data/stdlib/net-http/0/net-http.rbs +2211 -534
- data/stdlib/nkf/0/nkf.rbs +5 -5
- data/stdlib/objspace/0/objspace.rbs +31 -14
- data/stdlib/openssl/0/openssl.rbs +11 -7
- data/stdlib/optparse/0/optparse.rbs +20 -17
- data/stdlib/pathname/0/pathname.rbs +21 -4
- data/stdlib/pstore/0/pstore.rbs +378 -154
- data/stdlib/pty/0/pty.rbs +24 -8
- data/stdlib/ripper/0/ripper.rbs +1650 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -15
- data/stdlib/socket/0/socket.rbs +36 -3
- data/stdlib/strscan/0/string_scanner.rbs +7 -5
- data/stdlib/tempfile/0/tempfile.rbs +104 -44
- data/stdlib/time/0/time.rbs +2 -2
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/yaml/0/yaml.rbs +2 -2
- data/stdlib/zlib/0/zlib.rbs +1 -1
- metadata +8 -6
- data/core/deprecated.rbs +0 -9
- data/sig/shims/ripper.rbs +0 -8
data/core/range.rbs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#
|
|
5
5
|
# You can create an Range object explicitly with:
|
|
6
6
|
#
|
|
7
|
-
# * A [range literal](
|
|
7
|
+
# * A [range literal](rdoc-ref:syntax/literals.rdoc@Range+Literals):
|
|
8
8
|
#
|
|
9
9
|
# # Ranges that use '..' to include the given end value.
|
|
10
10
|
# (1..4).to_a # => [1, 2, 3, 4]
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
#
|
|
59
59
|
# Range.new(1, nil) # => 1..
|
|
60
60
|
#
|
|
61
|
-
# The literal for
|
|
62
|
-
#
|
|
63
|
-
#
|
|
61
|
+
# The literal for an endless range may be written with either two dots or three.
|
|
62
|
+
# The range has the same elements, either way. But note that the two are not
|
|
63
|
+
# equal:
|
|
64
64
|
#
|
|
65
65
|
# r0 = (1..) # => 1..
|
|
66
66
|
# r1 = (1...) # => 1...
|
|
@@ -84,6 +84,15 @@
|
|
|
84
84
|
# end
|
|
85
85
|
# a # => [2, 4, 6, 8, 10]
|
|
86
86
|
#
|
|
87
|
+
# A range can be both beginless and endless. For literal beginless, endless
|
|
88
|
+
# ranges, at least the beginning or end of the range must be given as an
|
|
89
|
+
# explicit nil value. It is recommended to use an explicit nil beginning and
|
|
90
|
+
# implicit nil end, since that is what Ruby uses for Range#inspect:
|
|
91
|
+
#
|
|
92
|
+
# (nil..) # => (nil..)
|
|
93
|
+
# (..nil) # => (nil..)
|
|
94
|
+
# (nil..nil) # => (nil..)
|
|
95
|
+
#
|
|
87
96
|
# ## Ranges and Other Classes
|
|
88
97
|
#
|
|
89
98
|
# An object may be put into a range if its class implements instance method
|
|
@@ -118,9 +127,8 @@
|
|
|
118
127
|
# ## Ranges and User-Defined Classes
|
|
119
128
|
#
|
|
120
129
|
# A user-defined class that is to be used in a range must implement instance
|
|
121
|
-
# `<=>`; see
|
|
122
|
-
#
|
|
123
|
-
# Integer#succ.
|
|
130
|
+
# `<=>`; see Integer#<=>. To make iteration available, it must also implement
|
|
131
|
+
# instance method `succ`; see Integer#succ.
|
|
124
132
|
#
|
|
125
133
|
# The class below implements both `<=>` and `succ`, and so can be used both to
|
|
126
134
|
# construct ranges and to iterate over them. Note that the Comparable module is
|
|
@@ -156,113 +164,66 @@
|
|
|
156
164
|
#
|
|
157
165
|
# First, what's elsewhere. Class Range:
|
|
158
166
|
#
|
|
159
|
-
# * Inherits from [class
|
|
160
|
-
#
|
|
161
|
-
# * Includes [module
|
|
162
|
-
# Enumerable](Enumerable.html#module-Enumerable-label-What-27s+Here), which
|
|
167
|
+
# * Inherits from [class Object](rdoc-ref:Object@What-27s+Here).
|
|
168
|
+
# * Includes [module Enumerable](rdoc-ref:Enumerable@What-27s+Here), which
|
|
163
169
|
# provides dozens of additional methods.
|
|
164
170
|
#
|
|
165
171
|
#
|
|
166
172
|
# Here, class Range provides methods that are useful for:
|
|
167
173
|
#
|
|
168
|
-
# * [Creating a Range](
|
|
169
|
-
# * [Querying](
|
|
170
|
-
# * [Comparing](
|
|
171
|
-
# * [Iterating](
|
|
172
|
-
# * [Converting](
|
|
174
|
+
# * [Creating a Range](rdoc-ref:Range@Methods+for+Creating+a+Range)
|
|
175
|
+
# * [Querying](rdoc-ref:Range@Methods+for+Querying)
|
|
176
|
+
# * [Comparing](rdoc-ref:Range@Methods+for+Comparing)
|
|
177
|
+
# * [Iterating](rdoc-ref:Range@Methods+for+Iterating)
|
|
178
|
+
# * [Converting](rdoc-ref:Range@Methods+for+Converting)
|
|
173
179
|
#
|
|
174
180
|
#
|
|
175
181
|
# ### Methods for Creating a Range
|
|
176
182
|
#
|
|
177
|
-
#
|
|
178
|
-
# : Returns a new range.
|
|
179
|
-
#
|
|
183
|
+
# * ::new: Returns a new range.
|
|
180
184
|
#
|
|
181
185
|
#
|
|
182
186
|
# ### Methods for Querying
|
|
183
187
|
#
|
|
184
|
-
#
|
|
185
|
-
# :
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
#
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
# :
|
|
192
|
-
#
|
|
193
|
-
#
|
|
194
|
-
# :
|
|
195
|
-
#
|
|
196
|
-
# #exclude_end?
|
|
197
|
-
# : Returns whether the end object is excluded.
|
|
198
|
-
#
|
|
199
|
-
# #first
|
|
200
|
-
# : Returns the first elements of `self`.
|
|
201
|
-
#
|
|
202
|
-
# #hash
|
|
203
|
-
# : Returns the integer hash code.
|
|
204
|
-
#
|
|
205
|
-
# #last
|
|
206
|
-
# : Returns the last elements of `self`.
|
|
207
|
-
#
|
|
208
|
-
# #max
|
|
209
|
-
# : Returns the maximum values in `self`.
|
|
210
|
-
#
|
|
211
|
-
# #min
|
|
212
|
-
# : Returns the minimum values in `self`.
|
|
213
|
-
#
|
|
214
|
-
# #minmax
|
|
215
|
-
# : Returns the minimum and maximum values in `self`.
|
|
216
|
-
#
|
|
217
|
-
# #size
|
|
218
|
-
# : Returns the count of elements in `self`.
|
|
219
|
-
#
|
|
188
|
+
# * #begin: Returns the begin value given for `self`.
|
|
189
|
+
# * #bsearch: Returns an element from `self` selected by a binary search.
|
|
190
|
+
# * #count: Returns a count of elements in `self`.
|
|
191
|
+
# * #end: Returns the end value given for `self`.
|
|
192
|
+
# * #exclude_end?: Returns whether the end object is excluded.
|
|
193
|
+
# * #first: Returns the first elements of `self`.
|
|
194
|
+
# * #hash: Returns the integer hash code.
|
|
195
|
+
# * #last: Returns the last elements of `self`.
|
|
196
|
+
# * #max: Returns the maximum values in `self`.
|
|
197
|
+
# * #min: Returns the minimum values in `self`.
|
|
198
|
+
# * #minmax: Returns the minimum and maximum values in `self`.
|
|
199
|
+
# * #size: Returns the count of elements in `self`.
|
|
220
200
|
#
|
|
221
201
|
#
|
|
222
202
|
# ### Methods for Comparing
|
|
223
203
|
#
|
|
224
|
-
#
|
|
225
|
-
#
|
|
226
|
-
#
|
|
227
|
-
#
|
|
228
|
-
#
|
|
229
|
-
#
|
|
230
|
-
#
|
|
231
|
-
# : Returns whether a given object is within `self`.
|
|
232
|
-
#
|
|
233
|
-
# #eql?
|
|
234
|
-
# : Returns whether a given object is equal to `self` (uses #eql?).
|
|
235
|
-
#
|
|
236
|
-
# #include? (aliased as #member?)
|
|
237
|
-
# : Returns whether a given object is an element of `self`.
|
|
238
|
-
#
|
|
204
|
+
# * #==: Returns whether a given object is equal to `self` (uses #==).
|
|
205
|
+
# * #===: Returns whether the given object is between the begin and end
|
|
206
|
+
# values.
|
|
207
|
+
# * #cover?: Returns whether a given object is within `self`.
|
|
208
|
+
# * #eql?: Returns whether a given object is equal to `self` (uses #eql?).
|
|
209
|
+
# * #include? (aliased as #member?): Returns whether a given object is an
|
|
210
|
+
# element of `self`.
|
|
239
211
|
#
|
|
240
212
|
#
|
|
241
213
|
# ### Methods for Iterating
|
|
242
214
|
#
|
|
243
|
-
#
|
|
244
|
-
#
|
|
245
|
-
#
|
|
246
|
-
#
|
|
247
|
-
#
|
|
248
|
-
# : Calls the block with each element of `self`.
|
|
249
|
-
#
|
|
250
|
-
# #step
|
|
251
|
-
# : Takes optional argument `n` (defaults to 1); calls the block with each
|
|
252
|
-
# `n`-th element of `self`.
|
|
253
|
-
#
|
|
215
|
+
# * #%: Requires argument `n`; calls the block with each `n`-th element of
|
|
216
|
+
# `self`.
|
|
217
|
+
# * #each: Calls the block with each element of `self`.
|
|
218
|
+
# * #step: Takes optional argument `n` (defaults to 1); calls the block with
|
|
219
|
+
# each `n`-th element of `self`.
|
|
254
220
|
#
|
|
255
221
|
#
|
|
256
222
|
# ### Methods for Converting
|
|
257
223
|
#
|
|
258
|
-
#
|
|
259
|
-
# :
|
|
260
|
-
#
|
|
261
|
-
# #to_a (aliased as #entries)
|
|
262
|
-
# : Returns elements of `self` in an array.
|
|
263
|
-
#
|
|
264
|
-
# #to_s
|
|
265
|
-
# : Returns a string representation of `self` (uses #to_s).
|
|
224
|
+
# * #inspect: Returns a string representation of `self` (uses #inspect).
|
|
225
|
+
# * #to_a (aliased as #entries): Returns elements of `self` in an array.
|
|
226
|
+
# * #to_s: Returns a string representation of `self` (uses #to_s).
|
|
266
227
|
#
|
|
267
228
|
class Range[out Elem] < Object
|
|
268
229
|
include Enumerable[Elem]
|
|
@@ -445,6 +406,47 @@ class Range[out Elem] < Object
|
|
|
445
406
|
# comparable.
|
|
446
407
|
#
|
|
447
408
|
#
|
|
409
|
+
# Beginless ranges cover all values of the same type before the end, excluding
|
|
410
|
+
# the end for exclusive ranges. Beginless ranges cover ranges that end before
|
|
411
|
+
# the end of the beginless range, or at the end of the beginless range for
|
|
412
|
+
# inclusive ranges.
|
|
413
|
+
#
|
|
414
|
+
# (..2).cover?(1) # => true
|
|
415
|
+
# (..2).cover?(2) # => true
|
|
416
|
+
# (..2).cover?(3) # => false
|
|
417
|
+
# (...2).cover?(2) # => false
|
|
418
|
+
# (..2).cover?("2") # => false
|
|
419
|
+
# (..2).cover?(..2) # => true
|
|
420
|
+
# (..2).cover?(...2) # => true
|
|
421
|
+
# (..2).cover?(.."2") # => false
|
|
422
|
+
# (...2).cover?(..2) # => false
|
|
423
|
+
#
|
|
424
|
+
# Endless ranges cover all values of the same type after the beginning. Endless
|
|
425
|
+
# exclusive ranges do not cover endless inclusive ranges.
|
|
426
|
+
#
|
|
427
|
+
# (2..).cover?(1) # => false
|
|
428
|
+
# (2..).cover?(3) # => true
|
|
429
|
+
# (2...).cover?(3) # => true
|
|
430
|
+
# (2..).cover?(2) # => true
|
|
431
|
+
# (2..).cover?("2") # => false
|
|
432
|
+
# (2..).cover?(2..) # => true
|
|
433
|
+
# (2..).cover?(2...) # => true
|
|
434
|
+
# (2..).cover?("2"..) # => false
|
|
435
|
+
# (2...).cover?(2..) # => false
|
|
436
|
+
# (2...).cover?(3...) # => true
|
|
437
|
+
# (2...).cover?(3..) # => false
|
|
438
|
+
# (3..).cover?(2..) # => false
|
|
439
|
+
#
|
|
440
|
+
# Ranges that are both beginless and endless cover all values and ranges, and
|
|
441
|
+
# return true for all arguments, with the exception that beginless and endless
|
|
442
|
+
# exclusive ranges do not cover endless inclusive ranges.
|
|
443
|
+
#
|
|
444
|
+
# (nil...).cover?(Object.new) # => true
|
|
445
|
+
# (nil...).cover?(nil...) # => true
|
|
446
|
+
# (nil..).cover?(nil...) # => true
|
|
447
|
+
# (nil...).cover?(nil..) # => false
|
|
448
|
+
# (nil...).cover?(1..) # => false
|
|
449
|
+
#
|
|
448
450
|
# Related: Range#include?.
|
|
449
451
|
#
|
|
450
452
|
def cover?: (untyped obj) -> bool
|
data/core/rational.rbs
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
#
|
|
6
6
|
# You can create a Rational object explicitly with:
|
|
7
7
|
#
|
|
8
|
-
# * A [rational
|
|
9
|
-
# literal](doc/syntax/literals_rdoc.html#label-Rational+Literals).
|
|
8
|
+
# * A [rational literal](rdoc-ref:syntax/literals.rdoc@Rational+Literals).
|
|
10
9
|
#
|
|
11
10
|
#
|
|
12
11
|
# You can convert certain objects to Rationals with:
|
|
13
12
|
#
|
|
14
|
-
# * Method
|
|
13
|
+
# * Method #Rational.
|
|
15
14
|
#
|
|
16
15
|
#
|
|
17
16
|
# Examples
|