Class: Conductor::Workflow::Dsl::TaskCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/workflow/dsl/switch_builder.rb,
lib/conductor/workflow/dsl/workflow_builder.rb

Overview

Helper class for collecting tasks in a block

Direct Known Subclasses

LoopCollector

Instance Method Summary collapse

Constructor Details

#initialize(parent_builder, task_array) ⇒ TaskCollector

Returns a new instance of TaskCollector.



53
54
55
56
# File 'lib/conductor/workflow/dsl/switch_builder.rb', line 53

def initialize(parent_builder, task_array)
  @parent = parent_builder
  @tasks = task_array
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, **kwargs, &block) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'lib/conductor/workflow/dsl/switch_builder.rb', line 58

def method_missing(name, *args, **kwargs, &block)
  if @parent.respond_to?(name, true)
    task_ref = @parent.send(name, *args, **kwargs, &block)
    @tasks << task_ref if task_ref.is_a?(TaskRef)
    task_ref
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/conductor/workflow/dsl/switch_builder.rb', line 68

def respond_to_missing?(name, include_private = false)
  @parent.respond_to?(name, include_private) || super
end

#wfObject

Access workflow inputs



973
974
975
# File 'lib/conductor/workflow/dsl/workflow_builder.rb', line 973

def wf
  @parent.wf
end