Module: Readlines::Check
- Defined in:
- lib/readlines/readlines/check.rb
Instance Method Summary collapse
Instance Method Details
#check_spelling_now(dictionary) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/readlines/readlines/check.rb', line 8 def check_spelling_now(dictionary) raise Readlines::NotFoundError, "File not found: #{@file_path}" unless ::File.exist?(@file_path) content = ::File.read(@file_path) misspelled_words = content.scan(/\b\w+\b/).reject { |word| dictionary.include?(word.downcase) } misspelled_words.uniq end |