Module: Cl::Suggest

Included in:
Cmd, Runner::Default, UnknownValues
Defined in:
lib/cl/helper/suggest.rb

Instance Method Summary collapse

Instance Method Details

#suggest(dict, value) ⇒ Object


3
4
5
6
7
8
# File 'lib/cl/helper/suggest.rb', line 3

def suggest(dict, value)
  return [] unless defined?(DidYouMean::SpellChecker)
  Array(value).map do |value|
    DidYouMean::SpellChecker.new(dictionary: dict.map(&:to_s)).correct(value.to_s)
  end.flatten
end