Class: UseCases::StepAdapters::Check
- Defined in:
- lib/use_cases/step_adapters/check.rb
Defined Under Namespace
Classes: InvalidReturnValue
Instance Attribute Summary
Attributes inherited from Abstract
#failure, #name, #object, #options
Instance Method Summary collapse
Methods inherited from Abstract
#bind, #call, #callable_args, #callable_args_count, #callable_method, #callable_object, #callable_proc, #external?, #hashed_args, #initialize, #missing?, #pass_option, #previous_input_param_name, #previous_step_result, #selects_external_args?, #with_option
Constructor Details
This class inherits a constructor from UseCases::StepAdapters::Abstract
Instance Method Details
#do_call(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/use_cases/step_adapters/check.rb', line 10 def do_call(*args) result = super(*args) raise InvalidReturnValue, "The return value should not be a Monad." if result.is_a?(Dry::Monads::Result) failure_code = [:failure] || :check_failure = [:failure_message] || "Failed" result ? Success(args.first) : Failure([failure_code, ]) end |