Module: Trailblazer::Activity::DSL::Linear::Strategy
Overview
holds the {@schema}
provides DSL step/merge!
provides DSL inheritance
provides run-time {call}
maintains the {state} with {seq} and normalizer options
Defined Under Namespace
Classes: BlockProxy
Class Method Summary collapse
-
.task_for!(state, type, task, options = {}, &block) ⇒ Object
Called from #step and friends.
Instance Method Summary collapse
-
#call(args, circuit_options = {}) ⇒ Object
Injects :exec_context so that :instance_methods work.
- #inherited(inheriter) ⇒ Object
- #initialize!(state) ⇒ Object
- #invoke(*args) ⇒ Object
-
#Path(**options, &block) ⇒ Object
syntactically, we can’t access the … end block here.
- #to_h ⇒ Object
Class Method Details
.task_for!(state, type, task, options = {}, &block) ⇒ Object
Called from #step and friends.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 26 def self.task_for!(state, type, task, ={}, &block) = .merge(dsl_track: type) # {#update_sequence} is the only way to mutate the state instance. state.update_sequence do |sequence:, normalizers:, normalizer_options:, fields:| # Compute the sequence rows. = normalizers.(type, normalizer_options: , options: task, user_options: .merge(sequence: sequence)) sequence = Activity::DSL::Linear::DSL.apply_adds_from_dsl(sequence, ) end end |
Instance Method Details
#call(args, circuit_options = {}) ⇒ Object
Injects :exec_context so that :instance_methods work.
97 98 99 100 101 102 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 97 def call(args, ={}) @activity.( args, .merge(exec_context: new) ) end |
#inherited(inheriter) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 18 def inherited(inheriter) super # inherits the {@sequence}, and options. inheriter.initialize!(@state.copy) end |
#initialize!(state) ⇒ Object
12 13 14 15 16 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 12 def initialize!(state) @state = state recompile_activity!(@state.to_h[:sequence]) end |
#invoke(*args) ⇒ Object
104 105 106 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 104 def invoke(*args) TaskWrap.invoke(self, *args) end |
#Path(**options, &block) ⇒ Object
syntactically, we can’t access the … end block here.
77 78 79 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 77 def Path(**, &block) # syntactically, we can't access the {do ... end} block here. BlockProxy.new(, block) end |
#to_h ⇒ Object
92 93 94 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 92 def to_h @activity.to_h.to_h.merge(activity: @activity) end |