svenfuchs/cl

View on GitHub
lib/cl/helper/suggest.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Cl
  module Suggest
    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
  end
end