Class Methods
3.3
View on GitHub
# File tmp/rubies/ruby-3.3.0/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
No documentation available
Instance Methods
3.3
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/did_you_mean/spell_checkers/key_error_checker.rb, line 10
def corrections
@corrections ||= exact_matches.empty? ? SpellChecker.new(dictionary: @keys).correct(@key).map(&:inspect) : exact_matches
end
No documentation available
3.3
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/did_you_mean/spell_checkers/key_error_checker.rb, line 16
def exact_matches
@exact_matches ||= @keys.select { |word| @key == word.to_s }.map(&:inspect)
end
No documentation available