Class: OmniService::Shortcut
- Inherits:
-
Object
- Object
- OmniService::Shortcut
- Extended by:
- Dry::Initializer
- Includes:
- Strict
- Defined in:
- lib/omni_service/shortcut.rb
Overview
Enables early pipeline exit on success. Used for idempotency and guard clauses.
On success: marks result with shortcut flag, causing Sequence to exit immediately. On failure: returns empty success, allowing pipeline to continue.
Instance Method Summary collapse
Methods included from Strict
Instance Method Details
#call(*params, **context) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/omni_service/shortcut.rb', line 30 def call(*params, **context) result = component_wrapper.call(*params, **context) if result.success? result.merge(shortcut: component) else OmniService::Result.build(self, params:, context:) end end |
#signature ⇒ Object
40 41 42 |
# File 'lib/omni_service/shortcut.rb', line 40 def signature @signature ||= [component_wrapper.signature.first, true] end |