Class: Rails::Command::Base::CorrectableError

Inherits:
Error
  • Object
show all
Includes:
DidYouMean::Correctable
Defined in:
lib/rails/command/base.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, key, options) ⇒ CorrectableError

Returns a new instance of CorrectableError.



20
21
22
23
24
# File 'lib/rails/command/base.rb', line 20

def initialize(message, key, options)
  @key     = key
  @options = options
  super(message)
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



18
19
20
# File 'lib/rails/command/base.rb', line 18

def key
  @key
end

#optionsObject (readonly)

Returns the value of attribute options.



18
19
20
# File 'lib/rails/command/base.rb', line 18

def options
  @options
end

Instance Method Details

#correctionsObject



29
30
31
# File 'lib/rails/command/base.rb', line 29

def corrections
  @corrections ||= DidYouMean::SpellChecker.new(dictionary: options).correct(key)
end