malavbhavsar/sentimentalizer

View on GitHub
lib/engine/document.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Document
  def initialize content
    @tokens = content.downcase.split.
      reject { |item| item.strip.empty? }.
      uniq
  end

  def each_token
    @tokens.each { |token| yield token }
  end
end