File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,20 @@ class Thor
2
2
Correctable =
3
3
begin
4
4
require 'did_you_mean'
5
+
6
+ module DidYouMean
7
+ # In order to support versions of Ruby that don't have keyword
8
+ # arguments, we need our own spell checker class that doesn't take key
9
+ # words. Even though this code wouldn't be hit because of the check
10
+ # above, it's still necessary because the interpreter would otherwise be
11
+ # unable to parse the file.
12
+ class NoKwargSpellChecker < SpellChecker
13
+ def initialize ( dictionary )
14
+ @dictionary = dictionary
15
+ end
16
+ end
17
+ end
18
+
5
19
DidYouMean ::Correctable
6
20
rescue LoadError
7
21
end
@@ -29,7 +43,7 @@ def corrections
29
43
end
30
44
31
45
def spell_checker
32
- DidYouMean ::SpellChecker . new ( dictionary : error . all_commands )
46
+ DidYouMean ::NoKwargSpellChecker . new ( error . all_commands )
33
47
end
34
48
end
35
49
@@ -72,7 +86,7 @@ def corrections
72
86
73
87
def spell_checker
74
88
@spell_checker ||=
75
- DidYouMean ::SpellChecker . new ( dictionary : error . switches )
89
+ DidYouMean ::NoKwargSpellChecker . new ( error . switches )
76
90
end
77
91
end
78
92
You can’t perform that action at this time.
0 commit comments