Module: Trailblazer::Activity::Adds

Defined in:
lib/trailblazer/activity/adds.rb

Overview

Developer’s docs: trailblazer.to/2.1/docs/internals#internals-wiring-api-adds-interface

The Adds interface are mechanics to alter sequences/pipelines. “one” ADDS structure: …, insert: [Insert, “id”]

To work with the instructions provided here, the pipeline structure needs to expose #to_a.

Defined Under Namespace

Modules: FriendlyInterface, Insert Classes: IndexError

Class Method Summary collapse

Class Method Details

.apply_adds(pipeline, adds) ⇒ Object

Inserts one or more Trailblazer::Activity::Adds into pipeline.



22
23
24
25
26
27
28
# File 'lib/trailblazer/activity/adds.rb', line 22

def apply_adds(pipeline, adds)
  adds.each do |add|
    pipeline = insert_row(pipeline, **add)
  end

  pipeline
end

.insert_row(pipeline, row:, insert:) ⇒ Object



15
16
17
18
19
# File 'lib/trailblazer/activity/adds.rb', line 15

def insert_row(pipeline, row:, insert:)
  insert_function, *args = insert

  insert_function.(pipeline, row, *args)
end