Class: Taskinator::Process::Sequential

Inherits:
Taskinator::Process show all
Defined in:
lib/taskinator/process.rb

Instance Attribute Summary

Attributes inherited from Taskinator::Process

#definition, #options, #parent, #uuid

Instance Method Summary collapse

Methods inherited from Taskinator::Process

#<=>, #accept, base_key, define_concurrent_process_for, define_sequential_process_for, #enqueue, #initialize, #no_tasks_defined?, #on_completed_entry, #on_failed_entry, #task_failed, #tasks, #to_s

Methods included from Taskinator::Persistence

included

Constructor Details

This class inherits a constructor from Taskinator::Process

Instance Method Details

#startObject



140
141
142
143
144
145
146
147
# File 'lib/taskinator/process.rb', line 140

def start
  task = tasks.first
  if task
    task.enqueue!
  else
    complete! # weren't any tasks to start with
  end
end

#task_completed(task) ⇒ Object



149
150
151
152
153
154
155
156
# File 'lib/taskinator/process.rb', line 149

def task_completed(task)
  next_task = task.next
  if next_task
    next_task.enqueue!
  else
    complete! if can_complete?
  end
end

#tasks_completed?(*args) ⇒ Boolean

Returns:

  • (Boolean)


158
159
160
161
# File 'lib/taskinator/process.rb', line 158

def tasks_completed?(*args)
  # TODO: optimize this
  tasks.all?(&:completed?)
end