Class: TypedOperation::Pipeline::StepWrapper
- Inherits:
-
Object
- Object
- TypedOperation::Pipeline::StepWrapper
- Includes:
- CallableResolver, Result::Mixin
- Defined in:
- lib/typed_operation/pipeline/step_wrapper.rb
Overview
Wraps a step operation to handle conditions and error attribution.
Instance Method Summary collapse
-
#call(*args, **kwargs) ⇒ Object
: (*untyped, **untyped) -> untyped.
-
#initialize(operation, name:, condition:, failure_handler:, first_step: false) ⇒ StepWrapper
constructor
: (untyped, name: Symbol, condition: (^(untyped) -> bool)?, failure_handler: (^(untyped, Symbol) -> untyped)?, ?first_step: bool) -> void.
Methods included from CallableResolver
#extract_operation_class, #uses_kwargs?
Constructor Details
#initialize(operation, name:, condition:, failure_handler:, first_step: false) ⇒ StepWrapper
: (untyped, name: Symbol, condition: (^(untyped) -> bool)?, failure_handler: (^(untyped, Symbol) -> untyped)?, ?first_step: bool) -> void
19 20 21 22 23 24 25 26 |
# File 'lib/typed_operation/pipeline/step_wrapper.rb', line 19 def initialize(operation, name:, condition:, failure_handler:, first_step: false) @operation = operation @name = name @condition = condition @failure_handler = failure_handler @first_step = first_step @uses_kwargs = uses_kwargs?(operation) end |
Instance Method Details
#call(*args, **kwargs) ⇒ Object
: (*untyped, **untyped) -> untyped
29 30 31 32 33 34 35 |
# File 'lib/typed_operation/pipeline/step_wrapper.rb', line 29 def call(*args, **kwargs) if @first_step call_first_step(*args, **kwargs) else call_subsequent_step(args.first) end end |