Sha256: 193862857b909eab37b21d5bc7ee685263c9490a56c991b12d8b4ba123677e7c

Contents?: true

Size: 650 Bytes

Versions: 5

Compression:

Stored size: 650 Bytes

Contents

module SpellCheck
  class ProofReader

    # @param [String] content text data.
    # @return [SpellCheck::Report] check result.
    def self.check(content)
      report = SpellCheck::Report.new

      content.lines.each.with_index(1) do |line, line_number|

        line.scan(/\w+/).each do |pattern|
          line.chomp!
          result = Filter.spellcheck(pattern)

          next if result[:correct]

          report.errata << Typo.new(
              pattern: pattern,
              expected: result[:expected],
              line: line,
              line_number: line_number
          )
        end
      end

      report
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spellcheck-0.3.4 lib/spellcheck/proof_reader.rb
spellcheck-0.3.3 lib/spellcheck/proof_reader.rb
spellcheck-0.3.2 lib/spellcheck/proof_reader.rb
spellcheck-0.3.1 lib/spellcheck/proof_reader.rb
spellcheck-0.3.0 lib/spellcheck/proof_reader.rb