rbs 2.3.2 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +10 -10
- data/core/errors.rbs +30 -0
- data/lib/rbs/prototype/rb.rb +35 -15
- data/lib/rbs/version.rb +1 -1
- data/sig/polyfill.rbs +0 -6
- data/stdlib/did_you_mean/0/did_you_mean.rbs +348 -0
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/steep/Gemfile.lock +5 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7f806cf8264c7ba086b2462e42604febb347b00cc657e642e39070e30825378
|
4
|
+
data.tar.gz: d3bcc382fb797715e27f811c0cd8b1876ef0d37a85599e169d9ce6f2a7bbbed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b84abd96145c319fde7b7f4a0a571d7c2c5ec0f959afd1bb3bdaaecb378b74153c235b45ab446e357812e0e29c14d2c4a993af0682c3c9799881720579b03d42
|
7
|
+
data.tar.gz: e2b41d9c74ccb0f19e553c955959cf0922bb72889e7f75dd7a40abe80f9d4773610c97a585969158d3130a289100d04b1cd533921165f3e84f67c6a84b89aa76
|
data/.github/workflows/ruby.yml
CHANGED
@@ -36,6 +36,8 @@ jobs:
|
|
36
36
|
image: rubylang/ruby:${{ matrix.container_tag }}
|
37
37
|
steps:
|
38
38
|
- uses: actions/checkout@v3
|
39
|
+
- name: Set working directory as safe
|
40
|
+
run: /usr/bin/git config --global --add safe.directory $(pwd)
|
39
41
|
- name: Install dependencies
|
40
42
|
run: |
|
41
43
|
apt-get update
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,26 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 2.4.0 (2022-05-08)
|
6
|
+
|
7
|
+
This is a minor release with some signature updates, `prototype rb` improvement, and test fixes.
|
8
|
+
|
9
|
+
### Signature updates
|
10
|
+
|
11
|
+
* did_you_mean ([\#980](https://github.com/ruby/rbs/pull/980))
|
12
|
+
* Pattern-matching exceptions ([\#979](https://github.com/ruby/rbs/pull/979/files))
|
13
|
+
* `Singleton::SingletonClassMethods` ([\#978](https://github.com/ruby/rbs/pull/978))
|
14
|
+
|
15
|
+
#### rbs prototype
|
16
|
+
|
17
|
+
* Omit unnecessary param name on keyword arg from `prototype rb` ([\#974](https://github.com/ruby/rbs/pull/974))
|
18
|
+
|
19
|
+
### Miscellaneous
|
20
|
+
|
21
|
+
* Fix git unsafe repository error on ci test ([\#985](https://github.com/ruby/rbs/pull/985))
|
22
|
+
* Prefer `IO::Buffer.new` for mutable buffer tests ([\#989](https://github.com/ruby/rbs/pull/989))
|
23
|
+
* Update steep ([\#990](https://github.com/ruby/rbs/pull/990))
|
24
|
+
|
5
25
|
## 2.3.2 (2022-04-06)
|
6
26
|
|
7
27
|
### Library changes
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs (2.
|
4
|
+
rbs (2.4.0)
|
5
5
|
|
6
6
|
PATH
|
7
7
|
remote: test/assets/test-gem
|
@@ -27,12 +27,12 @@ GEM
|
|
27
27
|
rainbow (>= 3.0, < 4.0)
|
28
28
|
strong_json (>= 1.1, < 2.2)
|
29
29
|
json (2.6.1)
|
30
|
-
json-schema (
|
31
|
-
addressable (>= 2.
|
30
|
+
json-schema (3.0.0)
|
31
|
+
addressable (>= 2.8)
|
32
32
|
marcel (1.0.2)
|
33
33
|
minitest (5.15.0)
|
34
34
|
parallel (1.22.1)
|
35
|
-
parser (3.1.
|
35
|
+
parser (3.1.2.0)
|
36
36
|
ast (~> 2.4.1)
|
37
37
|
power_assert (2.0.1)
|
38
38
|
prime (0.1.2)
|
@@ -40,14 +40,14 @@ GEM
|
|
40
40
|
singleton
|
41
41
|
psych (4.0.3)
|
42
42
|
stringio
|
43
|
-
public_suffix (4.0.
|
43
|
+
public_suffix (4.0.7)
|
44
44
|
rainbow (3.1.1)
|
45
45
|
rake (13.0.6)
|
46
|
-
rake-compiler (1.
|
46
|
+
rake-compiler (1.2.0)
|
47
47
|
rake
|
48
48
|
rdoc (6.4.0)
|
49
49
|
psych (>= 4.0.0)
|
50
|
-
regexp_parser (2.
|
50
|
+
regexp_parser (2.3.1)
|
51
51
|
rexml (3.2.5)
|
52
52
|
rspec (3.11.0)
|
53
53
|
rspec-core (~> 3.11.0)
|
@@ -62,16 +62,16 @@ GEM
|
|
62
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
63
|
rspec-support (~> 3.11.0)
|
64
64
|
rspec-support (3.11.0)
|
65
|
-
rubocop (1.
|
65
|
+
rubocop (1.28.2)
|
66
66
|
parallel (~> 1.10)
|
67
67
|
parser (>= 3.1.0.0)
|
68
68
|
rainbow (>= 2.2.2, < 4.0)
|
69
69
|
regexp_parser (>= 1.8, < 3.0)
|
70
70
|
rexml
|
71
|
-
rubocop-ast (>= 1.
|
71
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
72
72
|
ruby-progressbar (~> 1.7)
|
73
73
|
unicode-display_width (>= 1.4.0, < 3.0)
|
74
|
-
rubocop-ast (1.
|
74
|
+
rubocop-ast (1.17.0)
|
75
75
|
parser (>= 3.1.1.0)
|
76
76
|
rubocop-rubycw (0.1.6)
|
77
77
|
rubocop (~> 1.0)
|
data/core/errors.rbs
CHANGED
@@ -299,6 +299,36 @@ class NameError[T] < StandardError
|
|
299
299
|
def receiver: () -> T?
|
300
300
|
end
|
301
301
|
|
302
|
+
class NoMatchingPatternError < StandardError
|
303
|
+
end
|
304
|
+
|
305
|
+
class NoMatchingPatternKeyError[M, K] < NoMatchingPatternError
|
306
|
+
# <!--
|
307
|
+
# rdoc-file=error.c
|
308
|
+
# - NoMatchingPatternKeyError.new(message=nil, matchee: nil, key: nil) -> no_matching_pattern_key_error
|
309
|
+
# -->
|
310
|
+
# Construct a new `NoMatchingPatternKeyError` exception with the given message,
|
311
|
+
# matchee and key.
|
312
|
+
#
|
313
|
+
def initialize: (?string message, matchee: M, key: K) -> void
|
314
|
+
|
315
|
+
# <!--
|
316
|
+
# rdoc-file=error.c
|
317
|
+
# - no_matching_pattern_key_error.matchee -> object
|
318
|
+
# -->
|
319
|
+
# Return the matchee associated with this NoMatchingPatternKeyError exception.
|
320
|
+
#
|
321
|
+
def matchee: () -> M
|
322
|
+
|
323
|
+
# <!--
|
324
|
+
# rdoc-file=error.c
|
325
|
+
# - no_matching_pattern_key_error.key -> object
|
326
|
+
# -->
|
327
|
+
# Return the key caused this NoMatchingPatternKeyError exception.
|
328
|
+
#
|
329
|
+
def key: () -> K
|
330
|
+
end
|
331
|
+
|
302
332
|
# <!-- rdoc-file=error.c -->
|
303
333
|
# Raised when memory allocation fails.
|
304
334
|
#
|
data/lib/rbs/prototype/rb.rb
CHANGED
@@ -427,9 +427,9 @@ module RBS
|
|
427
427
|
|
428
428
|
case value
|
429
429
|
when nil, :NODE_SPECIAL_REQUIRED_KEYWORD
|
430
|
-
fun.required_keywords[name] = Types::Function::Param.new(name:
|
430
|
+
fun.required_keywords[name] = Types::Function::Param.new(name: nil, type: untyped)
|
431
431
|
when RubyVM::AbstractSyntaxTree::Node
|
432
|
-
fun.optional_keywords[name] = Types::Function::Param.new(name:
|
432
|
+
fun.optional_keywords[name] = Types::Function::Param.new(name: nil, type: param_type(value))
|
433
433
|
else
|
434
434
|
raise "Unexpected keyword arg value: #{value}"
|
435
435
|
end
|
@@ -444,23 +444,43 @@ module RBS
|
|
444
444
|
|
445
445
|
def function_return_type_from_body(node)
|
446
446
|
body = node.children[2]
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
types_to_union_type([*return_stmts, last_evaluated])
|
447
|
+
body_type(body)
|
448
|
+
end
|
449
|
+
|
450
|
+
def body_type(node)
|
451
|
+
return Types::Bases::Nil.new(location: nil) unless node
|
452
|
+
|
453
|
+
case node.type
|
454
|
+
when :IF, :UNLESS
|
455
|
+
if_unless_type(node)
|
456
|
+
when :BLOCK
|
457
|
+
block_type(node)
|
459
458
|
else
|
460
|
-
literal_to_type(
|
459
|
+
literal_to_type(node)
|
461
460
|
end
|
462
461
|
end
|
463
462
|
|
463
|
+
def if_unless_type(node)
|
464
|
+
raise unless node.type == :IF || node.type == :UNLESS
|
465
|
+
|
466
|
+
_exp_node, true_node, false_node = node.children
|
467
|
+
types_to_union_type([body_type(true_node), body_type(false_node)])
|
468
|
+
end
|
469
|
+
|
470
|
+
def block_type(node)
|
471
|
+
raise unless node.type == :BLOCK
|
472
|
+
|
473
|
+
return_stmts = any_node?(node) do |n|
|
474
|
+
n.type == :RETURN
|
475
|
+
end&.map do |return_node|
|
476
|
+
returned_value = return_node.children[0]
|
477
|
+
returned_value ? literal_to_type(returned_value) : Types::Bases::Nil.new(location: nil)
|
478
|
+
end || []
|
479
|
+
last_node = node.children.last
|
480
|
+
last_evaluated = last_node ? literal_to_type(last_node) : Types::Bases::Nil.new(location: nil)
|
481
|
+
types_to_union_type([*return_stmts, last_evaluated])
|
482
|
+
end
|
483
|
+
|
464
484
|
def literal_to_type(node)
|
465
485
|
case node.type
|
466
486
|
when :STR
|
data/lib/rbs/version.rb
CHANGED
data/sig/polyfill.rbs
CHANGED
@@ -8,12 +8,6 @@ module Gem
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
module Enumerable[unchecked out Elem]
|
12
|
-
def flat_map: [U] () { (Elem) -> Array[U] } -> Array[U]
|
13
|
-
| [U] () { (Elem) -> U } -> Array[U]
|
14
|
-
| ...
|
15
|
-
end
|
16
|
-
|
17
11
|
module Bundler
|
18
12
|
class LockfileParser
|
19
13
|
def initialize: (String) -> void
|
@@ -0,0 +1,348 @@
|
|
1
|
+
# <!-- rdoc-file=lib/did_you_mean.rb -->
|
2
|
+
# The `DidYouMean` gem adds functionality to suggest possible method/class names
|
3
|
+
# upon errors such as `NameError` and `NoMethodError`. In Ruby 2.3 or later, it
|
4
|
+
# is automatically activated during startup.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
#
|
8
|
+
# methosd
|
9
|
+
# # => NameError: undefined local variable or method `methosd' for main:Object
|
10
|
+
# # Did you mean? methods
|
11
|
+
# # method
|
12
|
+
#
|
13
|
+
# OBject
|
14
|
+
# # => NameError: uninitialized constant OBject
|
15
|
+
# # Did you mean? Object
|
16
|
+
#
|
17
|
+
# @full_name = "Yuki Nishijima"
|
18
|
+
# first_name, last_name = full_name.split(" ")
|
19
|
+
# # => NameError: undefined local variable or method `full_name' for main:Object
|
20
|
+
# # Did you mean? @full_name
|
21
|
+
#
|
22
|
+
# @@full_name = "Yuki Nishijima"
|
23
|
+
# @@full_anme
|
24
|
+
# # => NameError: uninitialized class variable @@full_anme in Object
|
25
|
+
# # Did you mean? @@full_name
|
26
|
+
#
|
27
|
+
# full_name = "Yuki Nishijima"
|
28
|
+
# full_name.starts_with?("Y")
|
29
|
+
# # => NoMethodError: undefined method `starts_with?' for "Yuki Nishijima":String
|
30
|
+
# # Did you mean? start_with?
|
31
|
+
#
|
32
|
+
# hash = {foo: 1, bar: 2, baz: 3}
|
33
|
+
# hash.fetch(:fooo)
|
34
|
+
# # => KeyError: key not found: :fooo
|
35
|
+
# # Did you mean? :foo
|
36
|
+
#
|
37
|
+
# ## Disabling `did_you_mean`
|
38
|
+
#
|
39
|
+
# Occasionally, you may want to disable the `did_you_mean` gem for e.g.
|
40
|
+
# debugging issues in the error object itself. You can disable it entirely by
|
41
|
+
# specifying `--disable-did_you_mean` option to the `ruby` command:
|
42
|
+
#
|
43
|
+
# $ ruby --disable-did_you_mean -e "1.zeor?"
|
44
|
+
# -e:1:in `<main>': undefined method `zeor?' for 1:Integer (NameError)
|
45
|
+
#
|
46
|
+
# When you do not have direct access to the `ruby` command (e.g. +rails
|
47
|
+
# console+, `irb`), you could applyoptions using the `RUBYOPT` environment
|
48
|
+
# variable:
|
49
|
+
#
|
50
|
+
# $ RUBYOPT='--disable-did_you_mean' irb
|
51
|
+
# irb:0> 1.zeor?
|
52
|
+
# # => NoMethodError (undefined method `zeor?' for 1:Integer)
|
53
|
+
#
|
54
|
+
# ## Getting the original error message
|
55
|
+
#
|
56
|
+
# Sometimes, you do not want to disable the gem entirely, but need to get the
|
57
|
+
# original error message without suggestions (e.g. testing). In this case, you
|
58
|
+
# could use the `#original_message` method on the error object:
|
59
|
+
#
|
60
|
+
# no_method_error = begin
|
61
|
+
# 1.zeor?
|
62
|
+
# rescue NoMethodError => error
|
63
|
+
# error
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# no_method_error.message
|
67
|
+
# # => NoMethodError (undefined method `zeor?' for 1:Integer)
|
68
|
+
# # Did you mean? zero?
|
69
|
+
#
|
70
|
+
# no_method_error.original_message
|
71
|
+
# # => NoMethodError (undefined method `zeor?' for 1:Integer)
|
72
|
+
#
|
73
|
+
module DidYouMean
|
74
|
+
# <!-- rdoc-file=lib/did_you_mean.rb -->
|
75
|
+
# TODO: Remove on 3.3:
|
76
|
+
#
|
77
|
+
SPELL_CHECKERS: untyped
|
78
|
+
|
79
|
+
NameErrorCheckers: Object
|
80
|
+
|
81
|
+
VERSION: String
|
82
|
+
|
83
|
+
class ClassNameChecker
|
84
|
+
class ClassName < ::String
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
module Correctable
|
89
|
+
SKIP_TO_S_FOR_SUPER_LOOKUP: true
|
90
|
+
|
91
|
+
# <!--
|
92
|
+
# rdoc-file=lib/did_you_mean/core_ext/name_error.rb
|
93
|
+
# - corrections()
|
94
|
+
# -->
|
95
|
+
#
|
96
|
+
def corrections: () -> Array[String]
|
97
|
+
end
|
98
|
+
|
99
|
+
# <!-- rdoc-file=lib/did_you_mean/formatter.rb -->
|
100
|
+
# The `DidYouMean::Formatter` is the basic, default formatter for the gem. The
|
101
|
+
# formatter responds to the `message_for` method and it returns a human readable
|
102
|
+
# string.
|
103
|
+
#
|
104
|
+
class Formatter
|
105
|
+
# <!--
|
106
|
+
# rdoc-file=lib/did_you_mean/formatter.rb
|
107
|
+
# - message_for(corrections)
|
108
|
+
# -->
|
109
|
+
# Returns a human readable string that contains `corrections`. This formatter is
|
110
|
+
# designed to be less verbose to not take too much screen space while being
|
111
|
+
# helpful enough to the user.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
#
|
115
|
+
# formatter = DidYouMean::Formatter.new
|
116
|
+
#
|
117
|
+
# # displays suggestions in two lines with the leading empty line
|
118
|
+
# puts formatter.message_for(["methods", "method"])
|
119
|
+
#
|
120
|
+
# Did you mean? methods
|
121
|
+
# method
|
122
|
+
# # => nil
|
123
|
+
#
|
124
|
+
# # displays an empty line
|
125
|
+
# puts formatter.message_for([])
|
126
|
+
#
|
127
|
+
# # => nil
|
128
|
+
#
|
129
|
+
def self.message_for: (Array[String] corrections) -> String
|
130
|
+
end
|
131
|
+
|
132
|
+
module JaroWinkler
|
133
|
+
WEIGHT: Float
|
134
|
+
|
135
|
+
THRESHOLD: Float
|
136
|
+
|
137
|
+
# <!--
|
138
|
+
# rdoc-file=lib/did_you_mean/jaro_winkler.rb
|
139
|
+
# - distance(str1, str2)
|
140
|
+
# -->
|
141
|
+
#
|
142
|
+
def self?.distance: (String, String) -> Integer
|
143
|
+
end
|
144
|
+
|
145
|
+
module Jaro
|
146
|
+
# <!--
|
147
|
+
# rdoc-file=lib/did_you_mean/jaro_winkler.rb
|
148
|
+
# - distance(str1, str2)
|
149
|
+
# -->
|
150
|
+
#
|
151
|
+
def self?.distance: (String, String) -> Integer
|
152
|
+
end
|
153
|
+
|
154
|
+
class KeyErrorChecker
|
155
|
+
# <!--
|
156
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/key_error_checker.rb
|
157
|
+
# - new(key_error)
|
158
|
+
# -->
|
159
|
+
#
|
160
|
+
def initialize: (KeyError[_ToS, Hash[_ToS, untyped]]) -> void
|
161
|
+
|
162
|
+
# <!--
|
163
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/key_error_checker.rb
|
164
|
+
# - corrections()
|
165
|
+
# -->
|
166
|
+
#
|
167
|
+
def corrections: () -> Array[String]
|
168
|
+
end
|
169
|
+
|
170
|
+
module Levenshtein
|
171
|
+
def self?.distance: (String, String) -> Integer?
|
172
|
+
end
|
173
|
+
|
174
|
+
class MethodNameChecker
|
175
|
+
NAMES_TO_EXCLUDE: Hash[untyped, Array[Symbol]]
|
176
|
+
|
177
|
+
# <!-- rdoc-file=lib/did_you_mean/spell_checkers/method_name_checker.rb -->
|
178
|
+
# `MethodNameChecker::RB_RESERVED_WORDS` is the list of reserved words in Ruby
|
179
|
+
# that take an argument. Unlike `VariableNameChecker::RB_RESERVED_WORDS`, these
|
180
|
+
# reserved words require an argument, and a `NoMethodError` is raised due to the
|
181
|
+
# presence of the argument.
|
182
|
+
#
|
183
|
+
# The `MethodNameChecker` will use this list to suggest a reversed word if a
|
184
|
+
# `NoMethodError` is raised and found closest matches.
|
185
|
+
#
|
186
|
+
# Also see `VariableNameChecker::RB_RESERVED_WORDS`.
|
187
|
+
#
|
188
|
+
RB_RESERVED_WORDS: Array[Symbol]
|
189
|
+
|
190
|
+
# <!--
|
191
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/method_name_checker.rb
|
192
|
+
# - new(exception)
|
193
|
+
# -->
|
194
|
+
#
|
195
|
+
def initialize: (NoMethodError[untyped] exception) -> void
|
196
|
+
|
197
|
+
# <!--
|
198
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/method_name_checker.rb
|
199
|
+
# - corrections()
|
200
|
+
# -->
|
201
|
+
#
|
202
|
+
def corrections: () -> Array[Symbol]
|
203
|
+
end
|
204
|
+
|
205
|
+
class NullChecker
|
206
|
+
# <!--
|
207
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/null_checker.rb
|
208
|
+
# - new(*)
|
209
|
+
# -->
|
210
|
+
#
|
211
|
+
def initialize: (*untyped) -> void
|
212
|
+
|
213
|
+
# <!--
|
214
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/null_checker.rb
|
215
|
+
# - corrections()
|
216
|
+
# -->
|
217
|
+
#
|
218
|
+
def corrections: () -> Array[untyped]
|
219
|
+
end
|
220
|
+
|
221
|
+
class PatternKeyNameChecker
|
222
|
+
# <!--
|
223
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb
|
224
|
+
# - new(no_matching_pattern_key_error)
|
225
|
+
# -->
|
226
|
+
#
|
227
|
+
def initialize: (untyped) -> void
|
228
|
+
|
229
|
+
# <!--
|
230
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb
|
231
|
+
# - corrections()
|
232
|
+
# -->
|
233
|
+
#
|
234
|
+
def corrections: () -> Array[String]
|
235
|
+
end
|
236
|
+
|
237
|
+
class RequirePathChecker
|
238
|
+
INITIAL_LOAD_PATH: Array[String]
|
239
|
+
ENV_SPECIFIC_EXT: String
|
240
|
+
|
241
|
+
# <!--
|
242
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/require_path_checker.rb
|
243
|
+
# - requireables()
|
244
|
+
# -->
|
245
|
+
#
|
246
|
+
def self.requireables: -> Array[String]
|
247
|
+
|
248
|
+
# <!--
|
249
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/require_path_checker.rb
|
250
|
+
# - new(exception)
|
251
|
+
# -->
|
252
|
+
#
|
253
|
+
def initialize: (untyped exception) -> void
|
254
|
+
|
255
|
+
# <!--
|
256
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/require_path_checker.rb
|
257
|
+
# - corrections()
|
258
|
+
# -->
|
259
|
+
#
|
260
|
+
def corrections: () -> Array[String]
|
261
|
+
end
|
262
|
+
|
263
|
+
class SpellChecker
|
264
|
+
# <!--
|
265
|
+
# rdoc-file=lib/did_you_mean/spell_checker.rb
|
266
|
+
# - new(dictionary:)
|
267
|
+
# -->
|
268
|
+
#
|
269
|
+
def initialize: (dictionary: Array[String | Symbol]) -> void
|
270
|
+
|
271
|
+
# <!--
|
272
|
+
# rdoc-file=lib/did_you_mean/spell_checker.rb
|
273
|
+
# - correct(input)
|
274
|
+
# -->
|
275
|
+
#
|
276
|
+
def correct: (String | Symbol input) -> Array[String]
|
277
|
+
end
|
278
|
+
|
279
|
+
# <!-- rdoc-file=lib/did_you_mean/tree_spell_checker.rb -->
|
280
|
+
# spell checker for a dictionary that has a tree structure, see
|
281
|
+
# doc/tree_spell_checker_api.md
|
282
|
+
#
|
283
|
+
class TreeSpellChecker
|
284
|
+
# <!--
|
285
|
+
# rdoc-file=lib/did_you_mean/tree_spell_checker.rb
|
286
|
+
# - new(dictionary:, separator: '/', augment: nil)
|
287
|
+
# -->
|
288
|
+
#
|
289
|
+
def initialize: (dictionary: Array[String], ?separator: String, ?augment: bool?) -> void
|
290
|
+
|
291
|
+
# <!--
|
292
|
+
# rdoc-file=lib/did_you_mean/tree_spell_checker.rb
|
293
|
+
# - correct(input)
|
294
|
+
# -->
|
295
|
+
#
|
296
|
+
def correct: (String input) -> Array[String]
|
297
|
+
end
|
298
|
+
|
299
|
+
class VariableNameChecker
|
300
|
+
NAMES_TO_EXCLUDE: Hash[String, Array[Symbol]]
|
301
|
+
|
302
|
+
# <!-- rdoc-file=lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb -->
|
303
|
+
# `VariableNameChecker::RB_RESERVED_WORDS` is the list of all reserved words in
|
304
|
+
# Ruby. They could be declared like methods are, and a typo would cause Ruby to
|
305
|
+
# raise a `NameError` because of the way they are declared.
|
306
|
+
#
|
307
|
+
# The `:VariableNameChecker` will use this list to suggest a reversed word if a
|
308
|
+
# `NameError` is raised and found closest matches, excluding:
|
309
|
+
#
|
310
|
+
# * +do+
|
311
|
+
# * +if+
|
312
|
+
# * +in+
|
313
|
+
# * +or+
|
314
|
+
#
|
315
|
+
# Also see `MethodNameChecker::RB_RESERVED_WORDS`.
|
316
|
+
#
|
317
|
+
RB_RESERVED_WORDS: Array[Symbol]
|
318
|
+
|
319
|
+
# <!--
|
320
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
|
321
|
+
# - new(exception)
|
322
|
+
# -->
|
323
|
+
#
|
324
|
+
def initialize: (NameError[untyped]) -> void
|
325
|
+
|
326
|
+
# <!--
|
327
|
+
# rdoc-file=lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
|
328
|
+
# - corrections()
|
329
|
+
# -->
|
330
|
+
#
|
331
|
+
def corrections: () -> Array[Symbol]
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
%a{annotate:rdoc:skip}
|
336
|
+
class NameError[T]
|
337
|
+
prepend DidYouMean::Correctable
|
338
|
+
end
|
339
|
+
|
340
|
+
%a{annotate:rdoc:skip}
|
341
|
+
class KeyError[K, R]
|
342
|
+
prepend DidYouMean::Correctable
|
343
|
+
end
|
344
|
+
|
345
|
+
%a{annotate:rdoc:skip}
|
346
|
+
class LoadError
|
347
|
+
prepend DidYouMean::Correctable
|
348
|
+
end
|
data/steep/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (7.0.2.
|
4
|
+
activesupport (7.0.2.4)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 1.6, < 2)
|
7
7
|
minitest (>= 5.1)
|
@@ -17,21 +17,21 @@ GEM
|
|
17
17
|
rb-inotify (~> 0.9, >= 0.9.10)
|
18
18
|
minitest (5.15.0)
|
19
19
|
parallel (1.22.1)
|
20
|
-
parser (3.1.
|
20
|
+
parser (3.1.2.0)
|
21
21
|
ast (~> 2.4.1)
|
22
22
|
rainbow (3.1.1)
|
23
23
|
rb-fsevent (0.11.1)
|
24
24
|
rb-inotify (0.10.1)
|
25
25
|
ffi (~> 1.0)
|
26
|
-
rbs (2.3.
|
27
|
-
steep (0.52.
|
26
|
+
rbs (2.3.2)
|
27
|
+
steep (0.52.2)
|
28
28
|
activesupport (>= 5.1)
|
29
29
|
language_server-protocol (>= 3.15, < 4.0)
|
30
30
|
listen (~> 3.0)
|
31
31
|
parallel (>= 1.0.0)
|
32
32
|
parser (>= 3.0)
|
33
33
|
rainbow (>= 2.2.2, < 4.0)
|
34
|
-
rbs (>= 2.3.
|
34
|
+
rbs (>= 2.3.2)
|
35
35
|
terminal-table (>= 2, < 4)
|
36
36
|
terminal-table (3.0.2)
|
37
37
|
unicode-display_width (>= 1.1.1, < 3)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: RBS is the language for type signatures for Ruby and standard library
|
14
14
|
definitions.
|
@@ -270,6 +270,7 @@ files:
|
|
270
270
|
- stdlib/date/0/date.rbs
|
271
271
|
- stdlib/date/0/date_time.rbs
|
272
272
|
- stdlib/dbm/0/dbm.rbs
|
273
|
+
- stdlib/did_you_mean/0/did_you_mean.rbs
|
273
274
|
- stdlib/digest/0/digest.rbs
|
274
275
|
- stdlib/erb/0/erb.rbs
|
275
276
|
- stdlib/fiber/0/fiber.rbs
|