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

Constant Summary

Constants inherited from DRbQS::Task

DEFAULT_GROUP

Instance Attribute Summary collapse

Attributes inherited from DRbQS::Task

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

Instance Method Summary collapse

Methods inherited from DRbQS::Task

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

Constructor Details

#initialize(task_ary) ⇒ TaskSet

Returns a new instance of TaskSet.



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/drbqs/task/task.rb', line 154

def initialize(task_ary)
  @original_note = task_ary.map do |task|
    task.note
  end.compact!
  group_sym = get_group_sym(task_ary)
  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, group: group_sym)
  else
    container = DRbQS::Task::TaskSet::ContainerWithoutHook.new(task_ary)
    @original_task = task_ary
    super(container, :exec, note: note_string, group: group_sym) 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.



152
153
154
# File 'lib/drbqs/task/task.rb', line 152

def original_note
  @original_note
end