Sha256: 82c123eea05d7c19418b3de9b26c5764dc79b78426112ce532faa6ccb3985a45
Contents?: true
Size: 494 Bytes
Versions: 6
Compression:
Stored size: 494 Bytes
Contents
# frozen_string_literal: true module ActionPolicy # Adds `suggest` method which uses did_you_mean # to generate a suggestion message module SuggestMessage if defined?(::DidYouMean::SpellChecker) def suggest(needle, heystack) suggestion = ::DidYouMean::SpellChecker.new( dictionary: heystack ).correct(needle).first suggestion ? "\nDid you mean? #{suggestion}" : "" end else def suggest(*__rest__) ; ""; end end end end
Version data entries
6 entries across 6 versions & 1 rubygems