Class: Taskinator::Process::Sequential

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

Instance Method Summary collapse

Instance Method Details

#startObject



118
119
120
121
122
123
124
125
# File 'lib/taskinator/process.rb', line 118

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

#task_completed(task) ⇒ Object



127
128
129
130
131
132
133
134
# File 'lib/taskinator/process.rb', line 127

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)


136
137
138
139
# File 'lib/taskinator/process.rb', line 136

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