Class: RubyReactor::Step::ComposeStep
- Inherits:
-
Object
- Object
- RubyReactor::Step::ComposeStep
- Includes:
- RubyReactor::Step
- Defined in:
- lib/ruby_reactor/step/compose_step.rb
Instance Attribute Summary collapse
-
#argument_mappings ⇒ Object
readonly
Returns the value of attribute argument_mappings.
-
#composed_reactor_class ⇒ Object
readonly
Returns the value of attribute composed_reactor_class.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(composed_reactor_class, argument_mappings = {}) ⇒ ComposeStep
constructor
A new instance of ComposeStep.
Methods included from RubyReactor::Step
Constructor Details
#initialize(composed_reactor_class, argument_mappings = {}) ⇒ ComposeStep
Returns a new instance of ComposeStep.
10 11 12 13 |
# File 'lib/ruby_reactor/step/compose_step.rb', line 10 def initialize(composed_reactor_class, argument_mappings = {}) @composed_reactor_class = composed_reactor_class @argument_mappings = argument_mappings end |
Instance Attribute Details
#argument_mappings ⇒ Object (readonly)
Returns the value of attribute argument_mappings.
8 9 10 |
# File 'lib/ruby_reactor/step/compose_step.rb', line 8 def argument_mappings @argument_mappings end |
#composed_reactor_class ⇒ Object (readonly)
Returns the value of attribute composed_reactor_class.
8 9 10 |
# File 'lib/ruby_reactor/step/compose_step.rb', line 8 def composed_reactor_class @composed_reactor_class end |
Class Method Details
.compensate(_reason, _arguments, _context) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/ruby_reactor/step/compose_step.rb', line 32 def self.compensate(_reason, _arguments, _context) # TODO: Implement proper compensation for composed reactors # This requires tracking the execution state of the composed reactor # and being able to trigger compensation on its completed steps. # For now, we assume the composed reactor handles its own compensation # or that compensation is not needed for composed steps. RubyReactor.Success() end |
.run(arguments, context) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby_reactor/step/compose_step.rb', line 15 def self.run(arguments, context) step_name = context.current_step composed_data = context.composed_contexts[step_name] child_context = prepare_child_context(arguments, context, composed_data) # Store the child context in composed_contexts BEFORE execution store_child_context(context, step_name, child_context) # Execute the composed reactor result = execute_child_reactor(arguments[:composed_reactor_class], child_context, composed_data) # Update the stored context store_child_context(context, step_name, child_context) handle_execution_result(result) end |