Class: Trailblazer::Activity::TaskWrap::Extension

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

Overview

An Extension is a collection of ADDS objects to be inserted into a taskWrap. It gets called either at

* compile-time and adds its steps to the wrap_static (see Extension::WrapStatic)
* run-time in {TaskWrap::Runner} and adds its steps dynamically at runtime to the
  step's taskWrap

Defined Under Namespace

Classes: WrapStatic

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*extension_rows) ⇒ Extension

Returns a new instance of Extension.



38
39
40
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 38

def initialize(*extension_rows)
  @extension_rows = extension_rows # those rows are simple ADDS instructions.
end

Class Method Details

.build(*inserts) ⇒ Object

Build a taskWrap extension from the “friendly interface” id:, …]



31
32
33
34
35
36
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 31

def self.build(*inserts)
  # For performance reasons we're computing the ADDS here and not in {#call}.
  extension_rows = Activity::Adds::FriendlyInterface.adds_for(inserts)

  new(*extension_rows)
end

.WrapStatic(*inserts) ⇒ Object

Create extensions from the friendly interface that can alter the wrap_static of a step in an activity. The returned extensionn can be passed directly via :extensions to the compiler, or when using the ‘#step` DSL.



51
52
53
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 51

def self.WrapStatic(*inserts)
  WrapStatic.new(extension: TaskWrap.Extension(*inserts))
end

Instance Method Details

#call(task_wrap_pipeline) ⇒ Object

Merges extension_rows into the Pipeline instance. This is usually used in step extensions or at runtime for wrap_runtime.



44
45
46
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 44

def call(task_wrap_pipeline)
  Adds.apply_adds(task_wrap_pipeline, @extension_rows)
end