class TRecs::IncrementalStrategy

Attributes

message[R]
step[R]

Public Class Methods

new(options={}) click to toggle source
# File lib/trecs/strategies/incremental_strategy.rb, line 11
def initialize(options={})
  @message = options.fetch(:message)
  @command = options.fetch(:command) { nil }
  @step = options.fetch(:step) { 100 }
  
end

Public Instance Methods

perform() click to toggle source
# File lib/trecs/strategies/incremental_strategy.rb, line 18
def perform
  current_time(0)
  current_content("")
  save_frame

  message.each_char.each_with_object("") do |current_char, current_msg|
    current_msg << current_char

    current_time(timestamp_for(current_msg))
    current_content(current_msg.dup)
    save_frame
  end
end

Private Instance Methods

timestamp_for(message) click to toggle source
# File lib/trecs/strategies/incremental_strategy.rb, line 34
def timestamp_for(message)
  message.size * step
end