類別 DidYouMean::PatternKeyNameChecker

公開類別方法

new(no_matching_pattern_key_error) 按一下以切換來源
# 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

公開實例方法

corrections() 按一下以切換來源
# 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

私人實例方法

exact_matches() 按一下以切換來源
# File lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb, line 16
def exact_matches
  @exact_matches ||= @keys.select { |word| @key == word.to_s }.map(&:inspect)
end