Method: Trailblazer::Activity::TaskWrap::Extension::WrapStatic#call

Defined in:
lib/trailblazer/activity/task_wrap/extension.rb

#call(config:, task:) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 63

def call(config:, task:, **)
  # Add the extension's task(s) to the activity's {:wrap_static} taskWrap
  # which is stored in the {:config} field.
  wrap_static = config[:wrap_static]                 # the activity's {wrap_static}.
  task_wrap   = wrap_static[task] # the "original" taskWrap for {task}.

  # Overwrite the original task_wrap:
  wrap_static = wrap_static.merge(task => @extension.(task_wrap))

  # DISCUSS: does it make sense to test the immutable behavior here? What would be the worst outcome?
  config.merge(wrap_static: wrap_static) # Return new config hash. This needs to be immutable code!
end