Class: Document

Inherits:
Object
  • Object
show all
Defined in:
lib/engine/document.rb

Instance Method Summary collapse

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_tokenObject



8
9
10
# File 'lib/engine/document.rb', line 8

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