Class: God::DriverOperation

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

Overview

A DriverOperation is a TimedEvent that is due as soon as possible. It is used to execute an arbitrary method on the associated Task.

Instance Attribute Summary

Attributes inherited from TimedEvent

#at

Instance Method Summary collapse

Methods inherited from TimedEvent

#<=>, #due?

Constructor Details

#initialize(task, name, args) ⇒ DriverOperation

Initialize a new DriverOperation.

task - The Task upon which to operate. name - The Symbol name of the method to call. args - The Array of arguments to send to the method.



76
77
78
79
80
81
# File 'lib/god/driver.rb', line 76

def initialize(task, name, args)
  super(0)
  @task = task
  @name = name
  @args = args
end

Instance Method Details

#handle_eventObject

Handle the operation that was issued asynchronously.

Returns nothing.



86
87
88
# File 'lib/god/driver.rb', line 86

def handle_event
  @task.send(@name, *@args)
end