123456789_123456789_123456789_123456789_123456789_

Class: DidYouMean::KeyErrorChecker

Relationships & Source Files
Inherits: Object
Defined in: lib/did_you_mean/spell_checkers/key_error_checker.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(key_error) ⇒ KeyErrorChecker

[ GitHub ]

  
# File 'lib/did_you_mean/spell_checkers/key_error_checker.rb', line 5

def initialize(key_error)
  @key = key_error.key
  @keys = key_error.receiver.keys
end

Instance Method Details

#corrections

[ GitHub ]

  
# File 'lib/did_you_mean/spell_checkers/key_error_checker.rb', line 10

def corrections
  @corrections ||= SpellChecker.new(dictionary: @keys).correct(@key).map(&:inspect)
end