Class: Clusterer::DocumentsCount

Inherits:
Object
  • Object
show all
Defined in:
lib/clusterer/inverse_document_frequency.rb

Overview

DocumentsCount is used to store the count of number of documents seen. This class could have been just replaced by a simple variable, in InverseDocumentFrequency class but to make the InverseDocumentFrequency class more flexible and be able to store the count in DB/File store this class is provided.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocumentsCount

Returns a new instance of DocumentsCount.



31
32
33
# File 'lib/clusterer/inverse_document_frequency.rb', line 31

def initialize 
  @value = 0
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



30
31
32
# File 'lib/clusterer/inverse_document_frequency.rb', line 30

def value
  @value
end

Instance Method Details

#incrementObject



35
36
37
# File 'lib/clusterer/inverse_document_frequency.rb', line 35

def increment
  @value +=1
end