Class: Dry::Transaction::Extra::Steps::Tap
- Inherits:
-
Object
- Object
- Dry::Transaction::Extra::Steps::Tap
- Defined in:
- lib/dry/transaction/extra/steps/tap.rb
Overview
A step that mimics Ruby’s builtin [Kernel#tap](ruby-doc.org/3.1.2/Kernel.html#method-i-tap) method. If the step succeeds, the step output is ignored and the original input is returned. However, if the step fails, then that Failure is returned instead.
Instance Method Summary collapse
Instance Method Details
#call(operation, _options, args) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/dry/transaction/extra/steps/tap.rb', line 31 def call(operation, , args) result = operation.call(*args) return result if result.is_a?(Failure) Success(*args) end |