Class: Almicube::Aggregator::Base

Inherits:
Object
  • Object
show all
Includes:
Cog
Defined in:
lib/almicube/aggregator/base.rb

Direct Known Subclasses

SumAggregator

Instance Attribute Summary

Attributes included from Cog

#ranking

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Cog

#active?, #after_aggregate, #before_aggregate

Class Method Details

.connectionObject



7
8
9
# File 'lib/almicube/aggregator/base.rb', line 7

def connection
  @redis ||= Almicube::Config.config.connection
end

Instance Method Details

#aggregate(ranking = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/almicube/aggregator/base.rb', line 12

def aggregate(ranking=nil)
  self.ranking = ranking unless active? || ranking.nil?

  if self.ranking.data?
    data_aggregate self.ranking.key
  else
    sub_aggregate self.ranking.key
  end
end