Module: Trailblazer::Activity::DSL::Linear::Normalizer::OutputTuples::Connections
- Defined in:
- lib/trailblazer/activity/dsl/linear/normalizer/output_tuples.rb
Overview
Compile connections from tuples.
Class Method Summary collapse
-
.add_terminus(end_event, id:, sequence:, normalizers:) ⇒ Object
Returns ADDS for the new terminus.
-
.compile_wirings(ctx, adds:, output_tuples:, outputs:, id:) ⇒ Object
we want this in the end: => search strategy Process => target and make them :connections.
Class Method Details
.add_terminus(end_event, id:, sequence:, normalizers:) ⇒ Object
Returns ADDS for the new terminus.
149 150 151 152 153 |
# File 'lib/trailblazer/activity/dsl/linear/normalizer/output_tuples.rb', line 149 def add_terminus(end_event, id:, sequence:, normalizers:) = Linear::Sequence::Builder.invoke_normalizer_for(:terminus, end_event, {id: id}, sequence: sequence, normalizer_options: {}, normalizers: normalizers) [:adds] end |
.compile_wirings(ctx, adds:, output_tuples:, outputs:, id:) ⇒ Object
we want this in the end: => search strategy Process => target and make them :connections. This combines :connections and :outputs
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/trailblazer/activity/dsl/linear/normalizer/output_tuples.rb', line 127 def compile_wirings(ctx, adds:, output_tuples:, outputs:, id:, **) # DISCUSS: how could we add another magnetic_to to an end? # Go through all {Output() => Track()/Id()/End()} tuples. wirings = output_tuples.collect do |output, connector| (search_builder, search_args), connector_adds = connector.to_a(ctx) # Call {#to_a} on Track/Id/End/... adds += connector_adds semantic = output.semantic output = outputs[semantic] || raise("No `#{semantic}` output found for #{id.inspect} and outputs #{outputs.inspect}") # return proc to be called when compiling Seq, e.g. {ById(output, :id)} search_builder.(output, *search_args) end ctx[:wirings] = wirings ctx[:adds] = adds end |