Class: Operations::Components::Contract
- Defined in:
- lib/operations/components/contract.rb
Overview
Wraps contract call to adapt the result for further processing.
Constant Summary
Constants inherited from Base
Base::DEFAULT_NAMES_MAP, Base::MONADS_DO_WRAPPER_SIGNATURES
Instance Method Summary collapse
Instance Method Details
#call(params, context) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/operations/components/contract.rb', line 7 def call(params, context) contract_result = callable.call(params, **context) result( params: contract_result.to_h, context: contract_result.context.each.to_h, # This is the only smart way I figured out to pass options # to the schema error messages. The machinery is buried too # deeply in dry-schema so reproducing it or trying to use # some private API would be too fragile. errors: ->(**) { contract_result.errors(**) } ) end |