Class: Trailblazer::Activity::TaskWrap::Extension
- Inherits:
-
Object
- Object
- Trailblazer::Activity::TaskWrap::Extension
- 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
-
.build(*inserts) ⇒ Object
Build a taskWrap extension from the “friendly interface” id:, …].
-
.WrapStatic(*inserts) ⇒ Object
Create extensions from the friendly interface that can alter the wrap_static of a step in an activity.
Instance Method Summary collapse
-
#call(task_wrap_pipeline) ⇒ Object
Merges extension_rows into the Pipeline instance.
-
#deprecated_extension_for(extension_rows) ⇒ Object
TODO: remove me once we drop the pre-friendly interface.
-
#initialize(*extension_rows) ⇒ Extension
constructor
A new instance of Extension.
Constructor Details
#initialize(*extension_rows) ⇒ Extension
Returns a new instance of Extension.
46 47 48 49 50 |
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 46 def initialize(*extension_rows) extension_rows = deprecated_extension_for(extension_rows) # TODO: remove me soon! @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:, …]
39 40 41 42 43 44 |
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 39 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.
76 77 78 |
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 76 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.
54 55 56 |
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 54 def call(task_wrap_pipeline) Adds.apply_adds(task_wrap_pipeline, @extension_rows) end |
#deprecated_extension_for(extension_rows) ⇒ Object
TODO: remove me once we drop the pre-friendly interface.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/trailblazer/activity/task_wrap/extension.rb', line 59 def deprecated_extension_for(extension_rows) return extension_rows unless extension_rows.find { |ext| ext.is_a?(Array) } Deprecate.warn caller_locations[3], "You are using the old API for taskWrap extensions. Please update to the new TaskWrap.Extension() API." extension_rows.collect do |ary| { insert: ary[0..1], row: Pipeline.Row(*ary[2]) } end end |