Module: Foobara::TypeDeclarations::LazyElementTypes::Attributes

Defined in:
foobara-0.2.2/projects/type_declarations/src/lazy_element_types/attributes.rb

Class Method Summary collapse

Class Method Details

.resolve(type) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'foobara-0.2.2/projects/type_declarations/src/lazy_element_types/attributes.rb', line 7

def resolve(type)
  Namespace.use type.created_in_namespace do
    type_declarations = type.declaration_data[:element_type_declarations]

    type.element_types = if type_declarations
                           if type_declarations.empty?
                             {}
                           else
                             TypeDeclarations.strict do
                               domain = Domain.current

                               type_declarations.transform_values do |attribute_declaration|
                                 domain.foobara_type_from_declaration(attribute_declaration)
                               end
                             end
                           end
                         end
  end
end