Module: Omml::Configuration::TypeResolver

Included in:
Omml::Configuration
Defined in:
lib/omml/configuration/type_resolver.rb

Overview

Extended only by Omml::Configuration together with the sibling modules.

Instance Method Summary collapse

Instance Method Details

#resolve_root_class(document, context: context_id) ⇒ Object



21
22
23
24
25
26
# File 'lib/omml/configuration/type_resolver.rb', line 21

def resolve_root_class(document, context: context_id)
  resolve_type(
    resolve_root_type(root_name_from_document(document)),
    context: context,
  )
end

#resolve_type(type_name, context: context_id) ⇒ Object



7
8
9
10
11
# File 'lib/omml/configuration/type_resolver.rb', line 7

def resolve_type(type_name, context: context_id)
  require_context!(context)

  Lutaml::Model::GlobalContext.resolve_type(type_name, context)
end

#root_name_from_document(document) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/omml/configuration/type_resolver.rb', line 13

def root_name_from_document(document)
  root = root_element_from(document)
  root_name = root.name.split(":").last
  return root_name if root_namespace_uri(root) == Omml::Namespace.uri

  raise Omml::Errors::UnsupportedRootElementError, root_name
end