Module: Trailblazer::Activity::DSL::Linear::Strategy
- Extended by:
- Forwardable
- Defined in:
- lib/trailblazer/activity/dsl/linear/strategy.rb
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) ⇒ Object
we can’t access block here, syntactically.
- #to_h ⇒ Object
Class Method Details
.task_for!(state, type, task, options = {}, &block) ⇒ Object
Called from #step and friends.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 28 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:| # 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.
93 94 95 96 97 98 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 93 def call(args, ={}) @activity.( args, .merge(exec_context: new) ) end |
#inherited(inheriter) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 20 def inherited(inheriter) super # inherits the {@sequence}, and options. inheriter.initialize!(@state.copy) end |
#initialize!(state) ⇒ Object
14 15 16 17 18 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 14 def initialize!(state) @state = state recompile_activity!(@state.to_h[:sequence]) end |
#invoke(*args) ⇒ Object
100 101 102 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 100 def invoke(*args) TaskWrap.invoke(self, *args) end |
#Path(options) ⇒ Object
we can’t access block here, syntactically.
73 74 75 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 73 def Path() # we can't access {block} here, syntactically. BlockProxy.new() end |
#to_h ⇒ Object
88 89 90 |
# File 'lib/trailblazer/activity/dsl/linear/strategy.rb', line 88 def to_h @activity.to_h.to_h.merge(activity: @activity) end |