Class: Trailblazer::Activity::TaskWrap::Merge

Inherits:
Object
  • Object
show all
Defined in:
lib/trailblazer/activity/task_wrap/merge.rb

Overview

This is instantiated via the DSL, and passed to the :extension API, allowing to add steps to the Activity’s static_wrap. Compile-time function

Instance Method Summary collapse

Constructor Details

#initialize(extension_plan) ⇒ Merge

Returns a new instance of Merge.



7
8
9
# File 'lib/trailblazer/activity/task_wrap/merge.rb', line 7

def initialize(extension_plan)
  @extension_plan = extension_plan
end

Instance Method Details

#call(activity, task, local_options, *returned_options) ⇒ Object

API



12
13
14
15
16
17
18
19
20
# File 'lib/trailblazer/activity/task_wrap/merge.rb', line 12

def call(activity, task, local_options, *returned_options)
  # we could make the default initial_activity injectable via the DSL, the value would sit in returned_options or local_options.
  static_wrap = Activity::TaskWrap.wrap_static_for(task, activity: activity)

  # # macro might want to apply changes to the static task_wrap (e.g. Inject)
  new_wrap =  Activity::Path::Plan.merge( static_wrap, @extension_plan )

  activity[:wrap_static, task] = new_wrap
end