Class: Decouplio::Steps::Step
- Defined in:
- lib/decouplio/steps/step.rb
Instance Attribute Summary
Attributes inherited from BaseStep
Instance Method Summary collapse
-
#initialize(name:, on_success_type:, on_failure_type:) ⇒ Step
constructor
A new instance of Step.
- #process(instance:) ⇒ Object
- #resolve(result:, instance:) ⇒ Object
Constructor Details
#initialize(name:, on_success_type:, on_failure_type:) ⇒ Step
Returns a new instance of Step.
9 10 11 12 13 14 |
# File 'lib/decouplio/steps/step.rb', line 9 def initialize(name:, on_success_type:, on_failure_type:) super() @name = name @on_success_type = on_success_type @on_failure_type = on_failure_type end |
Instance Method Details
#process(instance:) ⇒ Object
16 17 18 19 20 |
# File 'lib/decouplio/steps/step.rb', line 16 def process(instance:) instance.append_railway_flow(@name) result = instance.send(@name, **instance.ctx) resolve(result: result, instance: instance) end |
#resolve(result:, instance:) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/decouplio/steps/step.rb', line 22 def resolve(result:, instance:) Decouplio::Steps::Shared::StepResolver.call( instance: instance, result: result, on_success_type: @on_success_type, on_failure_type: @on_failure_type ) end |