Class: JIJI::Dao::RateDao::RatesAggregator

Inherits:
AbstractAggregator show all
Defined in:
lib/jiji/dao/rate_dao.rb

Instance Attribute Summary

Attributes inherited from AbstractAggregator

#start

Attributes inherited from Aggregator

#scale

Instance Method Summary collapse

Methods inherited from AbstractAggregator

#flush, #next, #next_date

Methods inherited from Aggregator

#flush, #next

Constructor Details

#initialize(scale) ⇒ RatesAggregator

Returns a new instance of RatesAggregator.



100
101
102
# File 'lib/jiji/dao/rate_dao.rb', line 100

def initialize( scale )
  super
end

Instance Method Details

#aggregate(timed_data) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/jiji/dao/rate_dao.rb', line 103

def aggregate( timed_data )
  unless @rate
    @rate = PeriodicallyRate.new
    @rate.start_time = timed_data.time
  end
  @rate << timed_data
end

#aggregatedObject



110
111
112
113
114
115
116
# File 'lib/jiji/dao/rate_dao.rb', line 110

def aggregated
  @rate.end_time = @end
  vs = @rate
  @rate = PeriodicallyRate.new
  @rate.start_time = @end
  return vs
end