Class: God::DriverEvent

Inherits:
TimedEvent show all
Defined in:
lib/god/driver.rb

Overview

A DriverEvent is a TimedEvent with an associated Task and Condition. This is the primary mechanism for poll conditions to be scheduled.

Instance Attribute Summary

Attributes inherited from TimedEvent

#at

Instance Method Summary collapse

Methods inherited from TimedEvent

#<=>, #due?

Constructor Details

#initialize(delay, task, condition) ⇒ DriverEvent

Initialize a new DriverEvent.

delay - The Numeric delay for this event. task - The Task associated with this event. condition - The Condition associated with this event.


53
54
55
56
57
# File 'lib/god/driver.rb', line 53

def initialize(delay, task, condition)
  super(delay)
  @task = task
  @condition = condition
end

Instance Method Details

#handle_eventObject

Handle this event by invoking the underlying condition on the associated task.

Returns nothing.


63
64
65
# File 'lib/god/driver.rb', line 63

def handle_event
  @task.handle_poll(@condition)
end