class OFlow::Actors::Trigger

Attributes

count[R]

The number of time the timer has fired or shipped.

label[R]

Label for the Tracker is used and for trigger content.

with_tracker[R]

Boolean flag indicating a tracker should be added to the trigger content if true.

Public Class Methods

new(task, options) click to toggle source
Calls superclass method OFlow::Actor::new
# File lib/oflow/actors/trigger.rb, line 15
def initialize(task, options)
  super
  @count = 0
  set_options(options)
end

Public Instance Methods

new_event() click to toggle source
# File lib/oflow/actors/trigger.rb, line 21
def new_event()
  tracker = @with_tracker ? Tracker.create(@label) : nil
  Box.new({ source: task.full_name, label: @label, timestamp: Time.now.utc() }, tracker)
end
set_label(v) click to toggle source
# File lib/oflow/actors/trigger.rb, line 31
def set_label(v)
  v = v.to_s unless v.nil?
  @label = v
end
set_options(options) click to toggle source
# File lib/oflow/actors/trigger.rb, line 26
def set_options(options)
  set_with_tracker(options[:with_tracker])
  @label = options[:label].to_s
end
set_with_tracker(v) click to toggle source
# File lib/oflow/actors/trigger.rb, line 36
def set_with_tracker(v)
  v = false if v.nil?
  unless true == v || false == v
    raise ConfigError.new("Expected with_tracker to be a boolean, not a #{v.class}.")
  end
  @with_tracker = v
end