Class: Decouplio::Steps::Wrap
- Defined in:
- lib/decouplio/steps/wrap.rb
Instance Attribute Summary
Attributes inherited from BaseStep
Instance Method Summary collapse
-
#initialize(name:, klass:, method:, wrap_flow:, on_success_type:, on_failure_type:) ⇒ Wrap
constructor
A new instance of Wrap.
- #process(instance:) ⇒ Object
Constructor Details
#initialize(name:, klass:, method:, wrap_flow:, on_success_type:, on_failure_type:) ⇒ Wrap
Returns a new instance of Wrap.
10 11 12 13 14 15 16 17 18 |
# File 'lib/decouplio/steps/wrap.rb', line 10 def initialize(name:, klass:, method:, wrap_flow:, on_success_type:, on_failure_type:) super() @name = name @klass = klass @method = method @wrap_flow = wrap_flow @on_success_type = on_success_type @on_failure_type = on_failure_type end |
Instance Method Details
#process(instance:) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/decouplio/steps/wrap.rb', line 20 def process(instance:) instance.append_railway_flow(@name) if specific_wrap? @klass.public_send(@method) do Decouplio::Processor.call(instance: instance, **@wrap_flow) end else Decouplio::Processor.call(instance: instance, **@wrap_flow) end resolve(instance: instance) end |