Module: Trailblazer::Activity::DSL::Linear::Helper
- Included in:
- Strategy
- Defined in:
- lib/trailblazer/activity/dsl/linear/helper.rb,
lib/trailblazer/activity/dsl/linear/helper/path.rb
Overview
Defined Under Namespace
Instance Method Summary collapse
- #DataVariable ⇒ Object
- #End(semantic) ⇒ Object
- #end_id(semantic:) ⇒ Object
- #Extension(*args, **kws) ⇒ Object
- #Id(id) ⇒ Object
- #In(**kws) ⇒ Object
- #Inject(*args, **kws) ⇒ Object
- #Out(**kws) ⇒ Object
-
#Output(signal, semantic = nil) ⇒ Object
Output( Left, :failure ) Output( :failure ) #=> Output::Semantic.
- #Path(end_task: nil, end_id: nil, **options, &block) ⇒ Object
-
#Subprocess(activity, patch: {}, strict: false) ⇒ Object
Computes the :outputs options for activity.
- #Track(color, wrap_around: false) ⇒ Object
Instance Method Details
#DataVariable ⇒ Object
102 103 104 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 102 def DataVariable DataVariableName.new end |
#End(semantic) ⇒ Object
33 34 35 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 33 def End(semantic) Normalizer::OutputTuples::End.new(semantic).freeze end |
#end_id(semantic:) ⇒ Object
37 38 39 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 37 def end_id(semantic:, **) "End.#{semantic}" # TODO: use everywhere end |
#Extension(*args, **kws) ⇒ Object
98 99 100 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 98 def Extension(*args, **kws) Normalizer::Extensions.Extension(*args, **kws) end |
#Id(id) ⇒ Object
45 46 47 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 45 def Id(id) Normalizer::OutputTuples::Id.new(id).freeze end |
#In(**kws) ⇒ Object
86 87 88 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 86 def In(**kws) VariableMapping::DSL::In(**kws) end |
#Inject(*args, **kws) ⇒ Object
94 95 96 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 94 def Inject(*args, **kws) VariableMapping::DSL::Inject(*args, **kws) end |
#Out(**kws) ⇒ Object
90 91 92 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 90 def Out(**kws) VariableMapping::DSL::Out(**kws) end |
#Output(signal, semantic = nil) ⇒ Object
Output( Left, :failure )
Output( :failure ) #=> Output::Semantic
27 28 29 30 31 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 27 def Output(signal, semantic = nil) return Normalizer::OutputTuples::Output::Semantic.new(signal) if semantic.nil? Normalizer::OutputTuples::Output::CustomOutput.new(signal, semantic) end |
#Path(end_task: nil, end_id: nil, **options, &block) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 49 def Path(end_task: nil, end_id: nil, **, &block) if end_task # TODO: remove in 2.0. Activity::Deprecate.warn caller_locations[0], %(Using `:end_task` and `:end_id` in Path() is deprecated, use `:terminus` instead. Please refer to https://trailblazer.to/2.1/docs/activity.html#activity-wiring-api-path-end_task-end_id-deprecation) = .merge( end_task: Activity.End(end_task.to_h[:semantic]), end_id: end_id ) end = .merge(block: block) if block Linear::PathBranch.new() # picked up by normalizer. end |
#Subprocess(activity, patch: {}, strict: false) ⇒ Object
Computes the :outputs options for activity.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 67 def Subprocess(activity, patch: {}, strict: false) activity = Linear::Patch.customize(activity, options: patch) outputs = activity.to_h[:outputs] = {} if strict .merge!( outputs.collect { |output| [Normalizer::OutputTuples::Output::Semantic.new(output.semantic, true), Track(output.semantic)] }.to_h ) end { task: activity, outputs: outputs.collect { |output| [output.semantic, output] }.to_h, } .merge() end |
#Track(color, wrap_around: false) ⇒ Object
41 42 43 |
# File 'lib/trailblazer/activity/dsl/linear/helper.rb', line 41 def Track(color, wrap_around: false) Normalizer::OutputTuples::Track.new(color, [], wrap_around: wrap_around).freeze end |