class Taskinator::Task::Step
a task which invokes the specified method on the definition the args must be intrinsic types, since they are serialized to YAML
Attributes
args[R]
definition[R]
method[R]
Public Class Methods
new(process, method, args, options={})
click to toggle source
Calls superclass method
Taskinator::Task::new
# File lib/taskinator/task.rb, line 162 def initialize(process, method, args, options={}) super(process, options) @definition = process.definition # for convenience raise ArgumentError, 'method' if method.nil? raise NoMethodError, method unless executor.respond_to?(method) @method = method @args = args end
Public Instance Methods
accept(visitor)
click to toggle source
Calls superclass method
Taskinator::Task#accept
# File lib/taskinator/task.rb, line 189 def accept(visitor) super visitor.visit_type(:definition) visitor.visit_attribute(:method) visitor.visit_args(:args) end
enqueue()
click to toggle source
# File lib/taskinator/task.rb, line 173 def enqueue Taskinator.queue.enqueue_task(self) end
executor()
click to toggle source
# File lib/taskinator/task.rb, line 196 def executor @executor ||= Taskinator::Executor.new(@definition, self) end
inspect()
click to toggle source
# File lib/taskinator/task.rb, line 200 def inspect %(#<#{self.class.name}:0x#{self.__id__.to_s(16)} uuid="#{uuid}", method=:#{method}, args=#{args}, current_state=:#{current_state}>) end
start()
click to toggle source
# File lib/taskinator/task.rb, line 177 def start executor.send(method, *args) # ASSUMPTION: when the method returns, the task is considered to be complete complete! rescue => e Taskinator.logger.error(e) Taskinator.logger.debug(e.backtrace) fail!(e) raise e end