Class: Document
- Inherits:
-
Object
- Object
- Document
- Defined in:
- lib/engine/document.rb
Instance Method Summary collapse
- #each_token ⇒ Object
-
#initialize(content) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(content) ⇒ Document
Returns a new instance of Document.
2 3 4 5 6 |
# File 'lib/engine/document.rb', line 2 def initialize content @tokens = content.downcase.split. reject { |item| item.strip.empty? }. uniq end |
Instance Method Details
#each_token ⇒ Object
8 9 10 |
# File 'lib/engine/document.rb', line 8 def each_token @tokens.each { |token| yield token } end |