Class: Taskinator::Process::Concurrent
Instance Attribute Summary collapse
#definition, #options, #parent, #uuid
Instance Method Summary
collapse
#<=>, base_key, define_concurrent_process_for, define_sequential_process_for, #enqueue, #no_tasks_defined?, #on_completed_entry, #on_failed_entry, #task_failed, #tasks, #to_s
included
Constructor Details
#initialize(definition, complete_on = CompleteOn::Default, options = {}) ⇒ Concurrent
167
168
169
170
|
# File 'lib/taskinator/process.rb', line 167
def initialize(definition, complete_on=CompleteOn::Default, options={})
super(definition, options)
@complete_on = complete_on
end
|
Instance Attribute Details
#complete_on ⇒ Object
Returns the value of attribute complete_on.
165
166
167
|
# File 'lib/taskinator/process.rb', line 165
def complete_on
@complete_on
end
|
Instance Method Details
#accept(visitor) ⇒ Object
195
196
197
198
|
# File 'lib/taskinator/process.rb', line 195
def accept(visitor)
super
visitor.visit_attribute(:complete_on)
end
|
#start ⇒ Object
172
173
174
175
176
177
178
|
# File 'lib/taskinator/process.rb', line 172
def start
if tasks.any?
tasks.each(&:enqueue!)
else
complete!
end
end
|
#task_completed(task) ⇒ Object
180
181
182
183
184
|
# File 'lib/taskinator/process.rb', line 180
def task_completed(task)
return if completed? || failed?
complete! if can_complete?
end
|
#tasks_completed?(*args) ⇒ Boolean
186
187
188
189
190
191
192
193
|
# File 'lib/taskinator/process.rb', line 186
def tasks_completed?(*args)
if (complete_on == CompleteOn::First)
tasks.any?(&:completed?)
else
tasks.all?(&:completed?)
end
end
|