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

Inherits:
Error
  • Object
show all
Includes:
DidYouMean::Correctable
Defined in:
railties/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.


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

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 'railties/lib/rails/command/base.rb', line 18

def key
  @key
end

#optionsObject (readonly)

Returns the value of attribute options


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

def options
  @options
end

Instance Method Details

#correctionsObject


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

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