Sha256: fa318d28a66539de85da6a99a7e133c969ed28e6e8274ecd606c40cc5a171296
Contents?: true
Size: 480 Bytes
Versions: 22
Compression:
Stored size: 480 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(*) = "" end end end
Version data entries
22 entries across 22 versions & 1 rubygems