Class: DidYouMean::PatternKeyNameChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb

Instance Method Summary collapse

Constructor Details

#initialize(no_matching_pattern_key_error) ⇒ PatternKeyNameChecker

Returns a new instance of PatternKeyNameChecker.



5
6
7
8
# File 'lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb', line 5

def initialize(no_matching_pattern_key_error)
  @key = no_matching_pattern_key_error.key
  @keys = no_matching_pattern_key_error.matchee.keys
end

Instance Method Details

#correctionsObject



10
11
12
# File 'lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb', line 10

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