Class: DidYouMean::PatternKeyNameChecker
- Inherits:
-
Object
- Object
- DidYouMean::PatternKeyNameChecker
- Defined in:
- lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb
Instance Method Summary collapse
- #corrections ⇒ Object
-
#initialize(no_matching_pattern_key_error) ⇒ PatternKeyNameChecker
constructor
A new instance of PatternKeyNameChecker.
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
#corrections ⇒ Object
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 |