Class: NxtSchema::Template::TypeResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/nxt_schema/template/type_resolver.rb

Instance Method Summary collapse

Instance Method Details

#resolve(type_system, type) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/nxt_schema/template/type_resolver.rb', line 4

def resolve(type_system, type)
  @resolve ||= {}
  @resolve[type] ||= begin
    if type.is_a?(Symbol)
      resolve_type_from_symbol(type, type_system)
    elsif type.respond_to?(:call)
      type
    else
      raise_type_not_resolvable_error(type)
    end
  rescue NxtRegistry::Errors::KeyNotRegisteredError => error
    raise_type_not_resolvable_error(type)
  end
end