class TRecs::ConfigStrategy

Attributes

format[R]
strategies[R]

Public Class Methods

new(options={}) click to toggle source
Calls superclass method
# File lib/trecs/strategies/config_strategy.rb, line 9
def initialize(options={})
  super(options)
  
  @format     = options.fetch(:format)     { "json" }
  @strategies = options.fetch(:strategies) { [] }
  @offset     = options.fetch(:offset)     { 0 }

  @writer = InMemoryWriter.new

end

Public Instance Methods

<<(strategy) click to toggle source
# File lib/trecs/strategies/config_strategy.rb, line 20
def <<(strategy)
  @strategies << strategy
end
append(*strategies) click to toggle source
# File lib/trecs/strategies/config_strategy.rb, line 24
def append(*strategies)
  strategies.each do |strategy|
    self << strategy
  end
end
perform() click to toggle source
# File lib/trecs/strategies/config_strategy.rb, line 30
def perform
  current_time(0)
  strategies.each do |strategy|
    strategy.write_frames_to(@writer)
    strategy.frames.each do |time, frame|
      current_content(frame.content)
      current_format(frame.format)
      current_time(time + offset)
      save_frame
    end
    self.offset = current_time + self.step
  end
  
end