Class: Thor::UnknownArgumentError::SpellChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/thor/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ SpellChecker

Returns a new instance of SpellChecker.



76
77
78
# File 'lib/thor/error.rb', line 76

def initialize(error)
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



74
75
76
# File 'lib/thor/error.rb', line 74

def error
  @error
end

Instance Method Details

#correctionsObject



80
81
82
83
# File 'lib/thor/error.rb', line 80

def corrections
  @corrections ||=
    error.unknown.flat_map { |unknown| spell_checker.correct(unknown) }.uniq.map(&:inspect)
end

#spell_checkerObject



85
86
87
# File 'lib/thor/error.rb', line 85

def spell_checker
  @spell_checker ||= NoKwargSpellChecker.new(error.switches)
end