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

Methods included from Taskinator::Persistence

included

Constructor Details

This class inherits a constructor from Taskinator::Process

Instance Method Details

#startObject



115
116
117
118
119
120
121
122
# File 'lib/taskinator/process.rb', line 115

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

#task_completed(task) ⇒ Object



124
125
126
127
128
129
130
131
# File 'lib/taskinator/process.rb', line 124

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)


133
134
135
136
# File 'lib/taskinator/process.rb', line 133

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