class OFlow::Actor
Actors
provide the custom functionality for Tasks. Each Task
creates an instance of some Actor
. Actors
are not shared between Tasks and each can be assure that the data they operate on is their own.
Attributes
The enclosing task.
Public Class Methods
Creates a new instance. @param task [Task] enclosing Task
@param options [Hash] additional options
# File lib/oflow/actor.rb, line 15 def initialize(task, options) @task = task end
Public Instance Methods
# File lib/oflow/actor.rb, line 55 def busy?() false end
Return array of Specs. @return [Array] Array of Specs.
# File lib/oflow/actor.rb, line 35 def inputs() nil end
Return any options that should be displayed as part of a Task.describe()
. @return [Hash] Hash of options with String keys.
# File lib/oflow/actor.rb, line 51 def options() {} end
Return array of Specs. @return [Array] Array of Specs.
# File lib/oflow/actor.rb, line 41 def outputs() nil end
Perform the primary functions for the Actor
. @param op [Symbol] operation to perform @param box [Box] contents or data for the operation
# File lib/oflow/actor.rb, line 22 def perform(op, box) end
# File lib/oflow/actor.rb, line 45 def set_option(key, value) set_options({ key.to_sym => value }) end
Returns whether the Actor
should have it's own thread or not. In almost all cases the Actor
should have it's own thread. The exception is when the action is trivial such as a relay. @return [true|false] indicator of whether a new thread should be created.
# File lib/oflow/actor.rb, line 29 def with_own_thread() true end