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/file_test.rbs
CHANGED
|
@@ -6,34 +6,41 @@
|
|
|
6
6
|
module FileTest
|
|
7
7
|
# <!--
|
|
8
8
|
# rdoc-file=file.c
|
|
9
|
-
# - File.blockdev?(
|
|
9
|
+
# - File.blockdev?(filepath) -> true or false
|
|
10
10
|
# -->
|
|
11
|
-
# Returns `true` if
|
|
11
|
+
# Returns `true` if `filepath` points to a block device, `false` otherwise:
|
|
12
12
|
#
|
|
13
|
-
#
|
|
13
|
+
# File.blockdev?('/dev/sda1') # => true
|
|
14
|
+
# File.blockdev?(File.new('t.tmp')) # => false
|
|
14
15
|
#
|
|
15
16
|
def self?.blockdev?: (String | IO file_name) -> bool
|
|
16
17
|
|
|
17
18
|
# <!--
|
|
18
19
|
# rdoc-file=file.c
|
|
19
|
-
# - File.chardev?(
|
|
20
|
+
# - File.chardev?(filepath) -> true or false
|
|
20
21
|
# -->
|
|
21
|
-
# Returns `true` if
|
|
22
|
+
# Returns `true` if `filepath` points to a character device, `false` otherwise.
|
|
22
23
|
#
|
|
23
|
-
#
|
|
24
|
+
# File.chardev?($stdin) # => true
|
|
25
|
+
# File.chardev?('t.txt') # => false
|
|
24
26
|
#
|
|
25
27
|
def self?.chardev?: (String | IO file_name) -> bool
|
|
26
28
|
|
|
27
29
|
# <!--
|
|
28
30
|
# rdoc-file=file.c
|
|
29
|
-
# - File.directory?(
|
|
31
|
+
# - File.directory?(path) -> true or false
|
|
30
32
|
# -->
|
|
31
|
-
#
|
|
32
|
-
# directory,
|
|
33
|
+
# With string `object` given, returns `true` if `path` is a string path leading
|
|
34
|
+
# to a directory, or to a symbolic link to a directory; `false` otherwise:
|
|
33
35
|
#
|
|
34
|
-
#
|
|
36
|
+
# File.directory?('.') # => true
|
|
37
|
+
# File.directory?('foo') # => false
|
|
38
|
+
# File.symlink('.', 'dirlink') # => 0
|
|
39
|
+
# File.directory?('dirlink') # => true
|
|
40
|
+
# File.symlink('t,txt', 'filelink') # => 0
|
|
41
|
+
# File.directory?('filelink') # => false
|
|
35
42
|
#
|
|
36
|
-
#
|
|
43
|
+
# Argument `path` can be an IO object.
|
|
37
44
|
#
|
|
38
45
|
def self?.directory?: (String | IO file_name) -> bool
|
|
39
46
|
|
|
@@ -145,11 +152,13 @@ module FileTest
|
|
|
145
152
|
|
|
146
153
|
# <!--
|
|
147
154
|
# rdoc-file=file.c
|
|
148
|
-
# - File.pipe?(
|
|
155
|
+
# - File.pipe?(filepath) -> true or false
|
|
149
156
|
# -->
|
|
150
|
-
# Returns `true` if
|
|
157
|
+
# Returns `true` if `filepath` points to a pipe, `false` otherwise:
|
|
151
158
|
#
|
|
152
|
-
#
|
|
159
|
+
# File.mkfifo('tmp/fifo')
|
|
160
|
+
# File.pipe?('tmp/fifo') # => true
|
|
161
|
+
# File.pipe?('t.txt') # => false
|
|
153
162
|
#
|
|
154
163
|
def self?.pipe?: (String | IO file_name) -> bool
|
|
155
164
|
|
|
@@ -220,11 +229,13 @@ module FileTest
|
|
|
220
229
|
|
|
221
230
|
# <!--
|
|
222
231
|
# rdoc-file=file.c
|
|
223
|
-
# - File.socket?(
|
|
232
|
+
# - File.socket?(filepath) -> true or false
|
|
224
233
|
# -->
|
|
225
|
-
# Returns `true` if
|
|
234
|
+
# Returns `true` if `filepath` points to a socket, `false` otherwise:
|
|
226
235
|
#
|
|
227
|
-
#
|
|
236
|
+
# require 'socket'
|
|
237
|
+
# File.socket?(Socket.new(:INET, :STREAM)) # => true
|
|
238
|
+
# File.socket?(File.new('t.txt')) # => false
|
|
228
239
|
#
|
|
229
240
|
def self?.socket?: (String | IO file_name) -> bool
|
|
230
241
|
|
|
@@ -240,9 +251,13 @@ module FileTest
|
|
|
240
251
|
|
|
241
252
|
# <!--
|
|
242
253
|
# rdoc-file=file.c
|
|
243
|
-
# - File.symlink?(
|
|
254
|
+
# - File.symlink?(filepath) -> true or false
|
|
244
255
|
# -->
|
|
245
|
-
# Returns `true` if
|
|
256
|
+
# Returns `true` if `filepath` points to a symbolic link, `false` otherwise:
|
|
257
|
+
#
|
|
258
|
+
# symlink = File.symlink('t.txt', 'symlink')
|
|
259
|
+
# File.symlink?('symlink') # => true
|
|
260
|
+
# File.symlink?('t.txt') # => false
|
|
246
261
|
#
|
|
247
262
|
def self?.symlink?: (String file_name) -> bool
|
|
248
263
|
|
data/core/float.rbs
CHANGED
|
@@ -13,127 +13,71 @@
|
|
|
13
13
|
#
|
|
14
14
|
# You can create a Float object explicitly with:
|
|
15
15
|
#
|
|
16
|
-
# * A [floating-point
|
|
17
|
-
# literal](doc/syntax/literals_rdoc.html#label-Float+Literals).
|
|
16
|
+
# * A [floating-point literal](rdoc-ref:syntax/literals.rdoc@Float+Literals).
|
|
18
17
|
#
|
|
19
18
|
#
|
|
20
19
|
# You can convert certain objects to Floats with:
|
|
21
20
|
#
|
|
22
|
-
# * Method
|
|
21
|
+
# * Method #Float.
|
|
23
22
|
#
|
|
24
23
|
#
|
|
25
24
|
# ## What's Here
|
|
26
25
|
#
|
|
27
26
|
# First, what's elsewhere. Class Float:
|
|
28
27
|
#
|
|
29
|
-
# * Inherits from [class
|
|
30
|
-
# Numeric](Numeric.html#class-Numeric-label-What-27s+Here).
|
|
28
|
+
# * Inherits from [class Numeric](rdoc-ref:Numeric@What-27s+Here).
|
|
31
29
|
#
|
|
32
30
|
#
|
|
33
31
|
# Here, class Float provides methods for:
|
|
34
32
|
#
|
|
35
|
-
# * [Querying](
|
|
36
|
-
# * [Comparing](
|
|
37
|
-
# * [Converting](
|
|
33
|
+
# * [Querying](rdoc-ref:Float@Querying)
|
|
34
|
+
# * [Comparing](rdoc-ref:Float@Comparing)
|
|
35
|
+
# * [Converting](rdoc-ref:Float@Converting)
|
|
38
36
|
#
|
|
39
37
|
#
|
|
40
38
|
# ### Querying
|
|
41
39
|
#
|
|
42
|
-
#
|
|
43
|
-
# :
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
# : Returns the integer hash code for `self`.
|
|
47
|
-
#
|
|
48
|
-
# #infinite?
|
|
49
|
-
# : Returns whether `self` is infinite.
|
|
50
|
-
#
|
|
51
|
-
# #nan?
|
|
52
|
-
# : Returns whether `self` is a NaN (not-a-number).
|
|
53
|
-
#
|
|
40
|
+
# * #finite?: Returns whether `self` is finite.
|
|
41
|
+
# * #hash: Returns the integer hash code for `self`.
|
|
42
|
+
# * #infinite?: Returns whether `self` is infinite.
|
|
43
|
+
# * #nan?: Returns whether `self` is a NaN (not-a-number).
|
|
54
44
|
#
|
|
55
45
|
#
|
|
56
46
|
# ### Comparing
|
|
57
47
|
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
# :
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
# greater than the given value.
|
|
67
|
-
#
|
|
68
|
-
# [==](#method-i-3D-3D) (aliased as #=== and #eql>)
|
|
69
|
-
# : Returns whether `self` is equal to the given value.
|
|
70
|
-
#
|
|
71
|
-
# [>](#method-i-3E)
|
|
72
|
-
# : Returns whether `self` is greater than the given value.
|
|
73
|
-
#
|
|
74
|
-
# [>=](#method-i-3E-3D)
|
|
75
|
-
# : Returns whether `self` is greater than or equal to the given value.
|
|
76
|
-
#
|
|
48
|
+
# * #<: Returns whether `self` is less than the given value.
|
|
49
|
+
# * #<=: Returns whether `self` is less than or equal to the given value.
|
|
50
|
+
# * #<=>: Returns a number indicating whether `self` is less than, equal to,
|
|
51
|
+
# or greater than the given value.
|
|
52
|
+
# * #== (aliased as #=== and #eql?): Returns whether `self` is equal to the
|
|
53
|
+
# given value.
|
|
54
|
+
# * #>: Returns whether `self` is greater than the given value.
|
|
55
|
+
# * #>=: Returns whether `self` is greater than or equal to the given value.
|
|
77
56
|
#
|
|
78
57
|
#
|
|
79
58
|
# ### Converting
|
|
80
59
|
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
# :
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
# :
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
# :
|
|
98
|
-
#
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
#
|
|
102
|
-
# #coerce
|
|
103
|
-
# : Returns a 2-element array containing the given value converted to a
|
|
104
|
-
# Float and `self`
|
|
105
|
-
#
|
|
106
|
-
# #divmod
|
|
107
|
-
# : Returns a 2-element array containing the quotient and remainder
|
|
108
|
-
# results of dividing `self` by the given value.
|
|
109
|
-
#
|
|
110
|
-
# #fdiv
|
|
111
|
-
# : Returns the Float result of dividing `self` by the given value.
|
|
112
|
-
#
|
|
113
|
-
# #floor
|
|
114
|
-
# : Returns the greatest number smaller than or equal to `self`.
|
|
115
|
-
#
|
|
116
|
-
# #next_float
|
|
117
|
-
# : Returns the next-larger representable Float.
|
|
118
|
-
#
|
|
119
|
-
# #prev_float
|
|
120
|
-
# : Returns the next-smaller representable Float.
|
|
121
|
-
#
|
|
122
|
-
# #quo
|
|
123
|
-
# : Returns the quotient from dividing `self` by the given value.
|
|
124
|
-
#
|
|
125
|
-
# #round
|
|
126
|
-
# : Returns `self` rounded to the nearest value, to a given precision.
|
|
127
|
-
#
|
|
128
|
-
# #to_i (aliased as #to_int)
|
|
129
|
-
# : Returns `self` truncated to an Integer.
|
|
130
|
-
#
|
|
131
|
-
# #to_s (aliased as #inspect)
|
|
132
|
-
# : Returns a string containing the place-value representation of `self`
|
|
133
|
-
# in the given radix.
|
|
134
|
-
#
|
|
135
|
-
# #truncate
|
|
136
|
-
# : Returns `self` truncated to a given precision.
|
|
60
|
+
# * #% (aliased as #modulo): Returns `self` modulo the given value.
|
|
61
|
+
# * #*: Returns the product of `self` and the given value.
|
|
62
|
+
# * #**: Returns the value of `self` raised to the power of the given value.
|
|
63
|
+
# * #+: Returns the sum of `self` and the given value.
|
|
64
|
+
# * #-: Returns the difference of `self` and the given value.
|
|
65
|
+
# * #/: Returns the quotient of `self` and the given value.
|
|
66
|
+
# * #ceil: Returns the smallest number greater than or equal to `self`.
|
|
67
|
+
# * #coerce: Returns a 2-element array containing the given value converted to
|
|
68
|
+
# a Float and `self`
|
|
69
|
+
# * #divmod: Returns a 2-element array containing the quotient and remainder
|
|
70
|
+
# results of dividing `self` by the given value.
|
|
71
|
+
# * #fdiv: Returns the Float result of dividing `self` by the given value.
|
|
72
|
+
# * #floor: Returns the greatest number smaller than or equal to `self`.
|
|
73
|
+
# * #next_float: Returns the next-larger representable Float.
|
|
74
|
+
# * #prev_float: Returns the next-smaller representable Float.
|
|
75
|
+
# * #quo: Returns the quotient from dividing `self` by the given value.
|
|
76
|
+
# * #round: Returns `self` rounded to the nearest value, to a given precision.
|
|
77
|
+
# * #to_i (aliased as #to_int): Returns `self` truncated to an Integer.
|
|
78
|
+
# * #to_s (aliased as #inspect): Returns a string containing the place-value
|
|
79
|
+
# representation of `self` in the given radix.
|
|
80
|
+
# * #truncate: Returns `self` truncated to a given precision.
|
|
137
81
|
#
|
|
138
82
|
class Float < Numeric
|
|
139
83
|
public
|
|
@@ -546,7 +490,7 @@ class Float < Numeric
|
|
|
546
490
|
# rdoc-file=numeric.c
|
|
547
491
|
# - finite? -> true or false
|
|
548
492
|
# -->
|
|
549
|
-
# Returns `true` if `self` is not `Infinity`, `-Infinity`, or `
|
|
493
|
+
# Returns `true` if `self` is not `Infinity`, `-Infinity`, or `NaN`, `false`
|
|
550
494
|
# otherwise:
|
|
551
495
|
#
|
|
552
496
|
# f = 2.0 # => 2.0
|
data/core/gc.rbs
CHANGED
|
@@ -82,6 +82,8 @@ module GC
|
|
|
82
82
|
# count
|
|
83
83
|
# : The total number of garbage collections ran since application start (count
|
|
84
84
|
# includes both minor and major garbage collections)
|
|
85
|
+
# time
|
|
86
|
+
# : The total time spent in garbage collections (in milliseconds)
|
|
85
87
|
# heap_allocated_pages
|
|
86
88
|
# : The total number of `:heap_eden_pages` + `:heap_tomb_pages`
|
|
87
89
|
# heap_sorted_length
|
|
@@ -120,6 +122,12 @@ module GC
|
|
|
120
122
|
# : The total number of minor garbage collections run since process start
|
|
121
123
|
# major_gc_count
|
|
122
124
|
# : The total number of major garbage collections run since process start
|
|
125
|
+
# compact_count
|
|
126
|
+
# : The total number of compactions run since process start
|
|
127
|
+
# read_barrier_faults
|
|
128
|
+
# : The total number of times the read barrier was triggered during compaction
|
|
129
|
+
# total_moved_objects
|
|
130
|
+
# : The total number of objects compaction has moved
|
|
123
131
|
# remembered_wb_unprotected_objects
|
|
124
132
|
# : The total number of objects without write barriers
|
|
125
133
|
# remembered_wb_unprotected_objects_limit
|
|
@@ -180,7 +188,7 @@ module GC
|
|
|
180
188
|
def self.total_time: () -> Integer
|
|
181
189
|
|
|
182
190
|
# <!--
|
|
183
|
-
# rdoc-file=gc.
|
|
191
|
+
# rdoc-file=gc.c
|
|
184
192
|
# - GC.compact
|
|
185
193
|
# -->
|
|
186
194
|
# This function compacts objects together in Ruby's heap. It eliminates unused
|
|
@@ -192,6 +200,10 @@ module GC
|
|
|
192
200
|
# This method is implementation specific and not expected to be implemented in
|
|
193
201
|
# any implementation besides MRI.
|
|
194
202
|
#
|
|
203
|
+
# To test whether GC compaction is supported, use the idiom:
|
|
204
|
+
#
|
|
205
|
+
# GC.respond_to?(:compact)
|
|
206
|
+
#
|
|
195
207
|
def self.compact: () -> ::Hash[:considered | :moved, Hash[Symbol | Integer, Integer]]
|
|
196
208
|
|
|
197
209
|
# <!--
|
|
@@ -204,7 +216,7 @@ module GC
|
|
|
204
216
|
# moved are replaced with T_MOVED objects. No object should have a reference to
|
|
205
217
|
# a T_MOVED object after compaction.
|
|
206
218
|
#
|
|
207
|
-
# This function
|
|
219
|
+
# This function expands the heap to ensure room to move all objects, compacts
|
|
208
220
|
# the heap to make sure everything moves, updates all references, then performs
|
|
209
221
|
# a full GC. If any object contains a reference to a T_MOVED object, that
|
|
210
222
|
# object should be pushed on the mark stack, and will make a SEGV.
|
|
@@ -231,7 +243,7 @@ module GC
|
|
|
231
243
|
|
|
232
244
|
# <!--
|
|
233
245
|
# rdoc-file=gc.rb
|
|
234
|
-
# - GC.latest_gc_info ->
|
|
246
|
+
# - GC.latest_gc_info -> hash
|
|
235
247
|
# - GC.latest_gc_info(hash) -> hash
|
|
236
248
|
# - GC.latest_gc_info(:major_by) -> :malloc
|
|
237
249
|
# -->
|