aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/command/spellchecker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/command/spellchecker.rb')
-rw-r--r--railties/lib/rails/command/spellchecker.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/lib/rails/command/spellchecker.rb b/railties/lib/rails/command/spellchecker.rb
new file mode 100644
index 0000000000..154358cd45
--- /dev/null
+++ b/railties/lib/rails/command/spellchecker.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module Rails
+ module Command
+ module Spellchecker # :nodoc:
+ def self.suggest(word, from:)
+ DidYouMean::SpellChecker.new(dictionary: from.map(&:to_s)).correct(word).first
+ end
+ end
+ end
+end