Class: Dry::Types::Constructor::Function::Safe Private

Inherits:
Dry::Types::Constructor::Function show all
Defined in:
lib/dry/types/constructor/function.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wrapper for unsafe coercion functions

API:

  • private

Instance Attribute Summary

Attributes inherited from Dry::Types::Constructor::Function

#fn

Instance Method Summary collapse

Methods inherited from Dry::Types::Constructor::Function

#<<, #>>, [], #arity, #initialize, #to_ast, #wrapper?, yields_block?

Constructor Details

This class inherits a constructor from Dry::Types::Constructor::Function

Instance Method Details

#call(input) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



16
17
18
19
20
# File 'lib/dry/types/constructor/function.rb', line 16

def call(input, &)
  @fn.(input)
rescue ::NoMethodError, ::TypeError, ::ArgumentError => exception
  CoercionError.handle(exception, &)
end