Class: Picky::Analytics
Overview
This class is wrapped around indexes and extracts useful information to be displayed in beoootiful, live-updating graphs.
Instance Attribute Summary collapse
-
#indexes ⇒ Object
readonly
Returns the value of attribute indexes.
Instance Method Summary collapse
- #ids ⇒ Object
-
#initialize(*indexes) ⇒ Analytics
constructor
A new instance of Analytics.
-
#tokens ⇒ Object
Returns the number of tokens in all the inverted indexes.
Constructor Details
Instance Attribute Details
#indexes ⇒ Object (readonly)
Returns the value of attribute indexes.
10 11 12 |
# File 'lib/picky/analytics.rb', line 10 def indexes @indexes end |
Instance Method Details
#ids ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/picky/analytics.rb', line 26 def ids total = 0 indexes.each_bundle do |bundle| total += bundle.inverted.inject(0) { |total, (_, values)| total + values.size } end total end |
#tokens ⇒ Object
Returns the number of tokens in all the inverted indexes.
18 19 20 21 22 23 24 |
# File 'lib/picky/analytics.rb', line 18 def tokens total = 0 indexes.each_bundle do |bundle| total += bundle.inverted.size end total end |