class Dry::Types::Lax
Lax
types rescue from type-related errors when constructors fail
@api public
Public Instance Methods
call(input)
click to toggle source
@param [Object] input
@return [Object]
@api public
# File lib/dry/types/lax.rb, line 22 def call(input) type.call_safe(input) { |output = input| output } end
lax()
click to toggle source
@return [Lax]
@api public
# File lib/dry/types/lax.rb, line 52 def lax self end
to_ast(meta: true)
click to toggle source
@see Nominal#to_ast
@api public
# File lib/dry/types/lax.rb, line 45 def to_ast(meta: true) [:lax, type.to_ast(meta: meta)] end
try(input, &block)
click to toggle source
@param [Object] input @param [#call,nil] block
@yieldparam [Failure] failure @yieldreturn [Result]
@return [Result,Logic::Result]
@api public
# File lib/dry/types/lax.rb, line 38 def try(input, &block) type.try(input, &block) end
Private Instance Methods
decorate?(response)
click to toggle source
@param [Object, Dry::Types::Constructor
] response
@return [Boolean]
@api private
Calls superclass method
Dry::Types::Decorator#decorate?
# File lib/dry/types/lax.rb, line 63 def decorate?(response) super || response.is_a?(type.constructor_type) end