class Dry::Types::Safe
def call(input)
-
(Object)
-
Parameters:
-
input
(Object
) --
def call(input) result = try(input) if result.respond_to?(:input) result.input else input end end
def decorate?(response)
-
(Boolean)
-
Parameters:
-
response
(Object, Dry::Types::Constructor
) --
def decorate?(response) super || response.kind_of?(Constructor) end
def try(input, &block)
-
(Result)
-
Other tags:
- Yieldreturn: -
Other tags:
- Yieldparam: failure -
Parameters:
-
block
(#call
) -- -
input
(Object
) --
def try(input, &block) type.try(input, &block) rescue TypeError, ArgumentError => e result = failure(input, e.message) block ? yield(result) : result end