Class: JIJI::Dao::TradeResultDao::TradeAggregator

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

Instance Attribute Summary collapse

Attributes inherited from AbstractAggregator

#start

Attributes inherited from Aggregator

#scale

Instance Method Summary collapse

Methods inherited from AbstractAggregator

#flush, #initialize, #next, #next_date

Methods inherited from Aggregator

#flush, #initialize, #next

Constructor Details

This class inherits a constructor from JIJI::Dao::AbstractAggregator

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



122
123
124
# File 'lib/jiji/dao/trade_result_dao.rb', line 122

def values
  @values
end

Instance Method Details

#aggregate(timed_data) ⇒ Object



109
110
111
112
# File 'lib/jiji/dao/trade_result_dao.rb', line 109

def aggregate( timed_data )
  @values = Set.new unless @values
  @values += timed_data.values[0]
end

#aggregatedObject



113
114
115
116
117
118
119
120
121
# File 'lib/jiji/dao/trade_result_dao.rb', line 113

def aggregated
  begin
    str = @values.to_a.join(" ")
    return BasicTimedData.new( [str] \
      + [@start.to_i, @end.to_i], @end)
  ensure
    @values.clear if @values
  end
end