class Dry::Types::Constrained::Coercible
def try(input, &block)
-
(Result)
-
Other tags:
- Yieldreturn: -
Other tags:
- Yieldparam: failure -
Parameters:
-
block
(#call
) -- -
input
(Object
) --
def try(input, &block) result = type.try(input) if result.success? validation = rule.(result.input) if validation.success? result else block ? yield(validation) : validation end else block ? yield(result) : result end end