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, #queue, #task_failed, #tasks, #to_s

Methods included from Taskinator::Persistence

add_process_to_list, included, list_key

Constructor Details

This class inherits a constructor from Taskinator::Process

Instance Method Details

#startObject



144
145
146
147
148
149
150
151
# File 'lib/taskinator/process.rb', line 144

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

#task_completed(task) ⇒ Object



153
154
155
156
157
158
159
160
# File 'lib/taskinator/process.rb', line 153

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)


162
163
164
165
# File 'lib/taskinator/process.rb', line 162

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