Class: DRbQS::Task::TaskSet

Inherits:
DRbQS::Task show all
Defined in:
lib/drbqs/task/task.rb

Overview

DRbQS::Task::TaskSet is a child class of DRbQS::Task and consists of group of a number of tasks. Objects of the class are generated when we set the option :collect to Generator#set and therefore we are unaware of the objects of DRbQS::TaskSet in many cases.

Defined Under Namespace

Classes: Container, ContainerTask, ContainerWithoutHook

Instance Attribute Summary collapse

Attributes inherited from DRbQS::Task

#args, #hook, #method_name, #note, #obj

Instance Method Summary collapse

Methods inherited from DRbQS::Task

#==, call_task_method, #drb_args, #exec_hook, execute_task

Constructor Details

#initialize(task_ary) ⇒ TaskSet

Returns a new instance of TaskSet.



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/drbqs/task/task.rb', line 146

def initialize(task_ary)
  @original_note = task_ary.map do |task|
    task.note
  end.compact!
  if task_ary.all? { |task| !(Proc === task.hook) }
    container = DRbQS::Task::TaskSet::ContainerTask.new(task_ary)
    super(container, :exec, hook: :exec_all_hooks, note: note_string)
  else
    container = DRbQS::Task::TaskSet::ContainerWithoutHook.new(task_ary)
    @original_task = task_ary
    super(container, :exec, note: note_string) do |srv, result|
      result.each_with_index do |res, i|
        @original_task[i].exec_hook(srv, res)
      end
    end
  end
end

Instance Attribute Details

#original_noteObject (readonly)

Returns the value of attribute original_note.



144
145
146
# File 'lib/drbqs/task/task.rb', line 144

def original_note
  @original_note
end