Class: Observed::Task
- Inherits:
-
Object
show all
- Defined in:
- lib/observed/task.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6
7
8
|
# File 'lib/observed/task.rb', line 6
def name
@name
end
|
Instance Method Details
#compose(first_task) ⇒ Object
19
20
21
22
23
|
# File 'lib/observed/task.rb', line 19
def compose(first_task)
second_task = self
first_task.then(second_task)
end
|
#then(*tasks) ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# 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
|