File tree Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Original file line number Diff line number Diff line change 1
1
class Thor
2
- Correctable =
3
- begin
4
- require 'did_you_mean'
5
-
6
- # In order to support versions of Ruby that don't have keyword
7
- # arguments, we need our own spell checker class that doesn't take key
8
- # words. Even though this code wouldn't be hit because of the check
9
- # above, it's still necessary because the interpreter would otherwise be
10
- # unable to parse the file.
11
- class NoKwargSpellChecker < DidYouMean ::SpellChecker # :nodoc:
12
- def initialize ( dictionary )
13
- @dictionary = dictionary
14
- end
15
- end
16
-
17
- DidYouMean ::Correctable
18
- rescue LoadError , NameError
19
- end
2
+ Correctable = if defined? ( DidYouMean ::SpellChecker ) && defined? ( DidYouMean ::Correctable )
3
+ # In order to support versions of Ruby that don't have keyword
4
+ # arguments, we need our own spell checker class that doesn't take key
5
+ # words. Even though this code wouldn't be hit because of the check
6
+ # above, it's still necessary because the interpreter would otherwise be
7
+ # unable to parse the file.
8
+ class NoKwargSpellChecker < DidYouMean ::SpellChecker # :nodoc:
9
+ def initialize ( dictionary )
10
+ @dictionary = dictionary
11
+ end
12
+ end
13
+
14
+ DidYouMean ::Correctable
15
+ end
20
16
21
17
# Thor::Error is raised when it's caused by wrong usage of thor classes. Those
22
18
# errors have their backtrace suppressed and are nicely shown to the user.
You can’t perform that action at this time.
0 commit comments