Class: Clusterer::DocumentsCount
- Inherits:
-
Object
- Object
- Clusterer::DocumentsCount
- 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
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #increment ⇒ Object
-
#initialize ⇒ DocumentsCount
constructor
A new instance of DocumentsCount.
Constructor Details
#initialize ⇒ DocumentsCount
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
#value ⇒ Object (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
#increment ⇒ Object
35 36 37 |
# File 'lib/clusterer/inverse_document_frequency.rb', line 35 def increment @value +=1 end |