class Ivar::Policy
def find_closest_match(ivar, known_ivars)
-
(Symbol, nil)
- The closest match or nil if none found
Parameters:
-
known_ivars
(Array
) -- List of known variables -
ivar
(Symbol
) -- The variable to find a match for
def find_closest_match(ivar, known_ivars) finder = DidYouMean::SpellChecker.new(dictionary: known_ivars) suggestions = finder.correct(ivar.to_s) suggestions.first&.to_sym if suggestions.any? end