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

task[R]

The enclosing task.

Public Class Methods

new(task, options) click to toggle source

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

busy?() click to toggle source
# File lib/oflow/actor.rb, line 55
def busy?()
  false
end
inputs() click to toggle source

Return array of Specs. @return [Array] Array of Specs.

# File lib/oflow/actor.rb, line 35
def inputs()
  nil
end
options() click to toggle source

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
outputs() click to toggle source

Return array of Specs. @return [Array] Array of Specs.

# File lib/oflow/actor.rb, line 41
def outputs()
  nil
end
perform(op, box) click to toggle source

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
set_option(key, value) click to toggle source
# File lib/oflow/actor.rb, line 45
def set_option(key, value)
  set_options({ key.to_sym => value })
end
with_own_thread() click to toggle source

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