Method: Attributor.resolve_type

Defined in:
lib/attributor.rb

.resolve_type(attr_type, options = {}, constructor_block = nil) ⇒ Object

Parameters:

  • type (Class)

    The class of the type to resolve

Raises:



26
27
28
29
30
31
32
33
# File 'lib/attributor.rb', line 26

def self.resolve_type(attr_type, options = {}, constructor_block = nil)
  klass = self.find_type(attr_type)

  return klass.construct(constructor_block, **options) if klass.constructable?
  raise AttributorException, "Type: #{attr_type} does not support anonymous generation" if constructor_block

  klass
end