Class: Bayes::PaulGraham::Corpus
- Inherits:
-
Hash
- Object
- Hash
- Bayes::PaulGraham::Corpus
- Defined in:
- lib/bayes.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
- #<<(src) ⇒ Object
-
#initialize ⇒ Corpus
constructor
A new instance of Corpus.
Constructor Details
#initialize ⇒ Corpus
Returns a new instance of Corpus.
203 204 205 206 |
# File 'lib/bayes.rb', line 203 def initialize super(0) @count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
202 203 204 |
# File 'lib/bayes.rb', line 202 def count @count end |
Instance Method Details
#<<(src) ⇒ Object
208 209 210 211 212 213 |
# File 'lib/bayes.rb', line 208 def <<(src) @count += 1 src.each do |i| self[i] += 1 end end |