rbs 3.0.0.dev.2 → 3.0.0.dev.3
Sign up to get free protection for your applications and to get access to all the features.
- 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/lib/rbs/version.rb
CHANGED
data/sig/collection/sources.rbs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module RBS
|
2
2
|
module Collection
|
3
3
|
module Sources
|
4
|
-
def self.from_config_entry: (Git::source_entry) -> Git
|
5
|
-
| (source_entry) -> t
|
4
|
+
def self.from_config_entry: (Git::source_entry, base_directory: Pathname) -> Git
|
5
|
+
| (source_entry, base_directory: Pathname) -> t
|
6
6
|
|
7
7
|
interface _Source
|
8
8
|
def has?: (String name, String? version) -> boolish
|
@@ -13,11 +13,12 @@ module RBS
|
|
13
13
|
def dependencies_of: (String name, String version) -> Array[manifest_dependency]?
|
14
14
|
end
|
15
15
|
|
16
|
-
type t = Git | Stdlib | Rubygems
|
16
|
+
type t = Git | Stdlib | Rubygems | Local
|
17
17
|
|
18
18
|
type source_entry = Git::source_entry
|
19
19
|
| Stdlib::source_entry
|
20
20
|
| Rubygems::source_entry
|
21
|
+
| Local::source_entry
|
21
22
|
|
22
23
|
type manifest_entry = {
|
23
24
|
"dependencies" => Array[manifest_dependency]?,
|
@@ -126,6 +127,34 @@ module RBS
|
|
126
127
|
def gems_versions: () -> Hash[String, Set[String]]
|
127
128
|
end
|
128
129
|
|
130
|
+
class Local
|
131
|
+
include Base
|
132
|
+
|
133
|
+
type source_entry = {
|
134
|
+
'type' => 'local',
|
135
|
+
'path' => String,
|
136
|
+
}
|
137
|
+
|
138
|
+
attr_reader path: Pathname
|
139
|
+
attr_reader full_path: Pathname
|
140
|
+
|
141
|
+
def initialize: (path: String, base_directory: Pathname) -> void
|
142
|
+
|
143
|
+
def has?: (String name, String? version) -> boolish
|
144
|
+
|
145
|
+
def versions: (String name) -> Array[String]
|
146
|
+
|
147
|
+
def install: (dest: Pathname, name: String, version: String, stdout: CLI::_IO) -> void
|
148
|
+
|
149
|
+
def to_lockfile: () -> source_entry
|
150
|
+
|
151
|
+
def manifest_of: (String name, String version) -> manifest_entry?
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
def _install: (Pathname src, Pathname dest) -> void
|
156
|
+
end
|
157
|
+
|
129
158
|
# signatures that are bundled in rbs gem under the stdlib/ directory
|
130
159
|
class Stdlib
|
131
160
|
|
data/sig/environment.rbs
CHANGED
@@ -147,10 +147,9 @@ module RBS
|
|
147
147
|
|
148
148
|
def buffers_decls: () -> Hash[Buffer, Array[AST::Declarations::t]]
|
149
149
|
|
150
|
-
#
|
151
|
-
# Construction of new environment is done with `<<` so that nested declarations will work well.
|
150
|
+
# Remove declarations and directives that are loaded from `buffers`
|
152
151
|
#
|
153
|
-
def
|
152
|
+
def unload: (Set[Buffer] buffers) -> Environment
|
154
153
|
|
155
154
|
# Returns true if an interface with the type name is defined
|
156
155
|
#
|
data/sig/locator.rbs
CHANGED
@@ -10,14 +10,22 @@ module RBS
|
|
10
10
|
| AST::TypeParam
|
11
11
|
| AST::Declarations::Class::Super
|
12
12
|
| AST::Declarations::Module::Self
|
13
|
+
| AST::Directives::t
|
14
|
+
| AST::Directives::Use::clause
|
15
|
+
|
16
|
+
# The buffer the location points to
|
17
|
+
#
|
18
|
+
attr_reader buffer: Buffer
|
13
19
|
|
14
20
|
# Array of _top-level_ declarations.
|
15
21
|
#
|
16
22
|
attr_reader decls: Array[AST::Declarations::t]
|
17
23
|
|
18
|
-
|
24
|
+
# Array of directives.
|
25
|
+
#
|
26
|
+
attr_reader dirs: Array[AST::Directives::t]
|
19
27
|
|
20
|
-
def buffer:
|
28
|
+
def initialize: (buffer: Buffer, decls: Array[AST::Declarations::t], dirs: Array[AST::Directives::t]) -> void
|
21
29
|
|
22
30
|
# Returns list of components.
|
23
31
|
# Inner component comes first.
|
@@ -29,6 +37,10 @@ module RBS
|
|
29
37
|
#
|
30
38
|
def find2: (line: Integer, column: Integer) -> [Symbol?, Array[component]]?
|
31
39
|
|
40
|
+
private
|
41
|
+
|
42
|
+
def find_in_directive: (Integer pos, AST::Directives::t, Array[component]) -> bool
|
43
|
+
|
32
44
|
def find_in_decl: (Integer pos, decl: AST::Declarations::t, array: Array[component]) -> bool
|
33
45
|
|
34
46
|
def find_in_member: (Integer pos, member: AST::Members::t, array: Array[component]) -> bool
|
File without changes
|
@@ -145,12 +145,8 @@ class BigDecimal < Numeric
|
|
145
145
|
|
146
146
|
# <!--
|
147
147
|
# rdoc-file=ext/bigdecimal/bigdecimal.c
|
148
|
-
# -
|
148
|
+
# - double_fig()
|
149
149
|
# -->
|
150
|
-
# Returns the number of digits a Float object is allowed to have; the result is
|
151
|
-
# system-dependent:
|
152
|
-
#
|
153
|
-
# BigDecimal.double_fig # => 16
|
154
150
|
#
|
155
151
|
def self.double_fig: () -> Integer
|
156
152
|
|
@@ -1007,7 +1003,9 @@ class BigDecimal < Numeric
|
|
1007
1003
|
# -->
|
1008
1004
|
# Returns the sign of the value.
|
1009
1005
|
#
|
1010
|
-
# Returns a positive value if > 0, a negative value if < 0
|
1006
|
+
# Returns a positive value if > 0, a negative value if < 0. It behaves the same
|
1007
|
+
# with zeros - it returns a positive value for a positive zero (BigDecimal('0'))
|
1008
|
+
# and a negative value for a negative zero (BigDecimal('-0')).
|
1011
1009
|
#
|
1012
1010
|
# The specific value returned indicates the type and sign of the BigDecimal, as
|
1013
1011
|
# follows:
|
@@ -1348,12 +1346,15 @@ module Kernel
|
|
1348
1346
|
# - BigDecimal(value, exception: true) -> bigdecimal
|
1349
1347
|
# - BigDecimal(value, ndigits, exception: true) -> bigdecimal
|
1350
1348
|
# -->
|
1351
|
-
# Returns the
|
1352
|
-
#
|
1349
|
+
# Returns the BigDecimal converted from `value` with a precision of `ndigits`
|
1350
|
+
# decimal digits.
|
1351
|
+
#
|
1352
|
+
# When `ndigits` is less than the number of significant digits in the value, the
|
1353
|
+
# result is rounded to that number of digits, according to the current rounding
|
1354
|
+
# mode; see BigDecimal.mode.
|
1353
1355
|
#
|
1354
|
-
#
|
1355
|
-
#
|
1356
|
-
# according to the current rounding mode; see BigDecimal.mode.
|
1356
|
+
# When `ndigits` is 0, the number of digits to correctly represent a float
|
1357
|
+
# number is determined automatically.
|
1357
1358
|
#
|
1358
1359
|
# Returns `value` converted to a BigDecimal, depending on the type of `value`:
|
1359
1360
|
#
|
@@ -1486,13 +1487,15 @@ class Float
|
|
1486
1487
|
# - float.to_d(precision) -> bigdecimal
|
1487
1488
|
# -->
|
1488
1489
|
# Returns the value of `float` as a BigDecimal. The `precision` parameter is
|
1489
|
-
# used to determine the number of significant digits for the result
|
1490
|
-
# is
|
1490
|
+
# used to determine the number of significant digits for the result. When
|
1491
|
+
# `precision` is set to `0`, the number of digits to represent the float being
|
1492
|
+
# converted is determined automatically. The default `precision` is `0`.
|
1491
1493
|
#
|
1492
1494
|
# require 'bigdecimal'
|
1493
1495
|
# require 'bigdecimal/util'
|
1494
1496
|
#
|
1495
1497
|
# 0.5.to_d # => 0.5e0
|
1498
|
+
# 1.234.to_d # => 0.1234e1
|
1496
1499
|
# 1.234.to_d(2) # => 0.12e1
|
1497
1500
|
#
|
1498
1501
|
# See also BigDecimal::new.
|
data/stdlib/cgi/0/core.rbs
CHANGED
@@ -882,6 +882,14 @@ class CGI
|
|
882
882
|
#
|
883
883
|
def escapeHTML: (string str) -> String
|
884
884
|
|
885
|
+
# <!--
|
886
|
+
# rdoc-file=ext/cgi/escape/escape.c
|
887
|
+
# - CGI.escapeURIComponent(string) -> string
|
888
|
+
# -->
|
889
|
+
# Returns URL-escaped string following RFC 3986.
|
890
|
+
#
|
891
|
+
def escapeURIComponent: (string) -> String
|
892
|
+
|
885
893
|
# <!--
|
886
894
|
# rdoc-file=ext/cgi/escape/escape.c
|
887
895
|
# - CGI.unescape(string, encoding=@@accept_charset) -> string
|
@@ -897,6 +905,14 @@ class CGI
|
|
897
905
|
# Returns HTML-unescaped string.
|
898
906
|
#
|
899
907
|
def unescapeHTML: (string str) -> String
|
908
|
+
|
909
|
+
# <!--
|
910
|
+
# rdoc-file=ext/cgi/escape/escape.c
|
911
|
+
# - CGI.unescapeURIComponent(string, encoding=@@accept_charset) -> string
|
912
|
+
# -->
|
913
|
+
# Returns URL-unescaped string following RFC 3986.
|
914
|
+
#
|
915
|
+
def unescapeURIComponent: (string) -> String
|
900
916
|
end
|
901
917
|
|
902
918
|
# <!-- rdoc-file=lib/cgi/core.rb -->
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# experimental, so these APIs may be changed in future.
|
4
4
|
#
|
5
5
|
# Caveat: Currently, only process-global coverage measurement is supported. You
|
6
|
-
# cannot measure per-thread
|
6
|
+
# cannot measure per-thread coverage.
|
7
7
|
#
|
8
8
|
# # Usage
|
9
9
|
#
|
@@ -153,7 +153,7 @@ module Coverage
|
|
153
153
|
# - line_stub(file)
|
154
154
|
# -->
|
155
155
|
#
|
156
|
-
def self.line_stub: () -> Array[Integer?]
|
156
|
+
def self.line_stub: (String) -> Array[Integer?]
|
157
157
|
|
158
158
|
# <!--
|
159
159
|
# rdoc-file=ext/coverage/coverage.c
|
@@ -190,15 +190,41 @@ module Coverage
|
|
190
190
|
|
191
191
|
# <!--
|
192
192
|
# rdoc-file=ext/coverage/coverage.c
|
193
|
-
# - Coverage.
|
194
|
-
# - Coverage.
|
195
|
-
# - Coverage.
|
196
|
-
# - Coverage.
|
193
|
+
# - Coverage.setup => nil
|
194
|
+
# - Coverage.setup(:all) => nil
|
195
|
+
# - Coverage.setup(lines: bool, branches: bool, methods: bool, eval: bool) => nil
|
196
|
+
# - Coverage.setup(oneshot_lines: true) => nil
|
197
|
+
# -->
|
198
|
+
# Set up the coverage measurement.
|
199
|
+
#
|
200
|
+
# Note that this method does not start the measurement itself. Use
|
201
|
+
# Coverage.resume to start the measurement.
|
202
|
+
#
|
203
|
+
# You may want to use Coverage.start to setup and then start the measurement.
|
204
|
+
#
|
205
|
+
def self.setup: (?lines: bool, ?branches: bool, ?methods: bool, ?eval: bool) -> nil
|
206
|
+
| (oneshot_lines: bool, ?branches: bool, ?methods: bool, ?eval: bool) -> nil
|
207
|
+
| (:all) -> nil
|
208
|
+
|
209
|
+
# <!--
|
210
|
+
# rdoc-file=ext/coverage/coverage.c
|
211
|
+
# - Coverage.start => nil
|
212
|
+
# - Coverage.start(:all) => nil
|
213
|
+
# - Coverage.start(lines: bool, branches: bool, methods: bool, eval: bool) => nil
|
214
|
+
# - Coverage.start(oneshot_lines: true) => nil
|
197
215
|
# -->
|
198
216
|
# Enables the coverage measurement. See the documentation of Coverage class in
|
199
217
|
# detail. This is equivalent to Coverage.setup and Coverage.resume.
|
200
218
|
#
|
201
|
-
|
219
|
+
alias self.start self.setup
|
220
|
+
|
221
|
+
# <!--
|
222
|
+
# rdoc-file=ext/coverage/coverage.c
|
223
|
+
# - Coverage.state => :idle, :suspended, :running
|
224
|
+
# -->
|
225
|
+
# Returns the state of the coverage measurement.
|
226
|
+
#
|
227
|
+
def self.state: () -> (:idle | :suspended | :running)
|
202
228
|
|
203
229
|
# <!--
|
204
230
|
# rdoc-file=ext/coverage/coverage.c
|
@@ -207,12 +233,28 @@ module Coverage
|
|
207
233
|
# Start/resume the coverage measurement.
|
208
234
|
#
|
209
235
|
# Caveat: Currently, only process-global coverage measurement is supported. You
|
210
|
-
# cannot measure per-thread
|
236
|
+
# cannot measure per-thread coverage. If your process has multiple thread, using
|
211
237
|
# Coverage.resume/suspend to capture code coverage executed from only a limited
|
212
238
|
# code block, may yield misleading results.
|
213
239
|
#
|
214
240
|
def self.resume: () -> nil
|
215
241
|
|
242
|
+
# <!--
|
243
|
+
# rdoc-file=ext/coverage/coverage.c
|
244
|
+
# - Coverage.supported?(mode) -> true or false
|
245
|
+
# -->
|
246
|
+
# Returns true if coverage measurement is supported for the given mode.
|
247
|
+
#
|
248
|
+
# The mode should be one of the following symbols: `:lines`, `:branches`,
|
249
|
+
# `:methods`, `:eval`.
|
250
|
+
#
|
251
|
+
# Example:
|
252
|
+
#
|
253
|
+
# Coverage.supported?(:lines) #=> true
|
254
|
+
# Coverage.supported?(:all) #=> false
|
255
|
+
#
|
256
|
+
def self.supported?: (Symbol) -> bool
|
257
|
+
|
216
258
|
# <!--
|
217
259
|
# rdoc-file=ext/coverage/coverage.c
|
218
260
|
# - Coverage.suspend => nil
|
data/stdlib/csv/0/csv.rbs
CHANGED
@@ -2488,7 +2488,7 @@ class CSV::Row < Object
|
|
2488
2488
|
# `index_or_header` and `specifiers`.
|
2489
2489
|
#
|
2490
2490
|
# The nested objects may be instances of various classes. See [Dig
|
2491
|
-
# Methods](
|
2491
|
+
# Methods](rdoc-ref:dig_methods.rdoc).
|
2492
2492
|
#
|
2493
2493
|
# Examples:
|
2494
2494
|
# source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n"
|