class DidYouMean::CorrectElement

identifies the elements close to element

Public Class Methods

new() click to toggle source
# File did_you_mean/tree_spell_checker.rb, line 117
def initialize
end

Public Instance Methods

call(names, element) click to toggle source
# File did_you_mean/tree_spell_checker.rb, line 120
def call(names, element)
  return names if names.size == 1
  str = normalize element
  return [str] if names.include? str
  checker = ::DidYouMean::SpellChecker.new(dictionary: names)
  checker.correct(str)
end