class Observed::Task

Attributes

name[RW]

Public Instance Methods

compose(first_task) click to toggle source
# File lib/observed/task.rb, line 19
def compose(first_task)
  second_task = self

  first_task.then(second_task)
end
then(*tasks) click to toggle source
# File lib/observed/task.rb, line 8
def then(*tasks)
  next_task = if tasks.size == 1
               tasks.first
             elsif tasks.size > 1
               ParallelTask.new(tasks)
             else
               raise 'No tasks to be executed'
             end
  SequenceTask.new(self, next_task)
end