Class: Thor::UnknownArgumentError::SpellChecker
- Inherits:
-
Object
- Object
- Thor::UnknownArgumentError::SpellChecker
- Defined in:
- lib/thor/error.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #corrections ⇒ Object
-
#initialize(error) ⇒ SpellChecker
constructor
A new instance of SpellChecker.
- #spell_checker ⇒ Object
Constructor Details
#initialize(error) ⇒ SpellChecker
Returns a new instance of SpellChecker.
69 70 71 |
# File 'lib/thor/error.rb', line 69 def initialize(error) @error = error end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
67 68 69 |
# File 'lib/thor/error.rb', line 67 def error @error end |
Instance Method Details
#corrections ⇒ Object
73 74 75 76 |
# File 'lib/thor/error.rb', line 73 def corrections @corrections ||= error.unknown.flat_map { |unknown| spell_checker.correct(unknown) }.uniq.map(&:inspect) end |
#spell_checker ⇒ Object
78 79 80 |
# File 'lib/thor/error.rb', line 78 def spell_checker @spell_checker ||= DidYouMean::SpellChecker.new(dictionary: error.switches) end |