-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure did_you_mean feature works when the gem is available
- Loading branch information
1 parent
f9f7488
commit 36c3646
Showing
3 changed files
with
14 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,14 @@ class Thor | |
begin | ||
require 'did_you_mean' | ||
|
||
module DidYouMean | ||
# In order to support versions of Ruby that don't have keyword | ||
# arguments, we need our own spell checker class that doesn't take key | ||
# words. Even though this code wouldn't be hit because of the check | ||
# above, it's still necessary because the interpreter would otherwise be | ||
# unable to parse the file. | ||
class NoKwargSpellChecker < SpellChecker | ||
def initialize(dictionary) | ||
@dictionary = dictionary | ||
end | ||
# In order to support versions of Ruby that don't have keyword | ||
# arguments, we need our own spell checker class that doesn't take key | ||
# words. Even though this code wouldn't be hit because of the check | ||
# above, it's still necessary because the interpreter would otherwise be | ||
# unable to parse the file. | ||
class NoKwargSpellChecker < DidYouMean::SpellChecker # :nodoc: | ||
This comment has been minimized.
Sorry, something went wrong.
mathieujobin
|
||
def initialize(dictionary) | ||
@dictionary = dictionary | ||
end | ||
end | ||
|
||
|
@@ -43,7 +41,7 @@ def corrections | |
end | ||
|
||
def spell_checker | ||
DidYouMean::NoKwargSpellChecker.new(error.all_commands) | ||
NoKwargSpellChecker.new(error.all_commands) | ||
end | ||
end | ||
|
||
|
@@ -85,8 +83,7 @@ def corrections | |
end | ||
|
||
def spell_checker | ||
@spell_checker ||= | ||
DidYouMean::NoKwargSpellChecker.new(error.switches) | ||
@spell_checker ||= NoKwargSpellChecker.new(error.switches) | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ah, needs to be part of
gemspec
...