Class: Trailblazer::Macro::Nested::Dynamic
- Inherits:
-
Object
- Object
- Trailblazer::Macro::Nested::Dynamic
- Defined in:
- lib/trailblazer/macro/nested.rb
Constant Summary collapse
- SUCCESS_SEMANTICS =
TODO: make this injectable/or get it from operation.
[:success, :pass_fast]
Class Method Summary collapse
- .call_dynamic_nested_activity(ctx, flow_options, runner:, **circuit_options) ⇒ Object
- .compute_legacy_return_signal(return_signal) ⇒ Object
-
.host_activity_for(activity:) ⇒ Object
This is used in Nested and Each where some tasks don’t have a corresponding, hard-wired activity.
Class Method Details
.call_dynamic_nested_activity(ctx, flow_options, runner:, **circuit_options) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/trailblazer/macro/nested.rb', line 86 def self.call_dynamic_nested_activity((ctx, ), runner:, **) nested_activity = [:decision] = .slice(*(.keys - [:decision])) host_activity = Dynamic.host_activity_for(activity: nested_activity) # TODO: make activity here that has only one step (plus In and Out config) which is {nested_activity} return_signal, (ctx, ) = runner.( nested_activity, [ctx, ], # pass {flow_options} without a {:decision}. runner: runner, **, activity: host_activity ) return compute_legacy_return_signal(return_signal), [ctx, ] end |
.compute_legacy_return_signal(return_signal) ⇒ Object
105 106 107 108 |
# File 'lib/trailblazer/macro/nested.rb', line 105 def self.compute_legacy_return_signal(return_signal) actual_semantic = return_signal.to_h[:semantic] applied_signal = SUCCESS_SEMANTICS.include?(actual_semantic) ? Activity::Right : Activity::Left # TODO: we could also provide PassFast/FailFast. end |
.host_activity_for(activity:) ⇒ Object
This is used in Nested and Each where some tasks don’t have a corresponding, hard-wired activity. This is needed for TaskWrap.invoke and the Debugging API in tracing.
113 114 115 116 117 118 |
# File 'lib/trailblazer/macro/nested.rb', line 113 def self.host_activity_for(activity:) Activity::TaskWrap.container_activity_for( activity, id: activity.to_s ) end |