Class: Lutaml::Lml::ImportResolver
- Inherits:
-
Object
- Object
- Lutaml::Lml::ImportResolver
- Defined in:
- lib/lutaml/lml/import_resolver.rb
Instance Method Summary collapse
-
#initialize(base_dir) ⇒ ImportResolver
constructor
A new instance of ImportResolver.
-
#resolve(document) ⇒ Object
Returns [entity_index, associations] where entity_index maps entity name → entity.
Constructor Details
#initialize(base_dir) ⇒ ImportResolver
Returns a new instance of ImportResolver.
8 9 10 |
# File 'lib/lutaml/lml/import_resolver.rb', line 8 def initialize(base_dir) @base_dir = base_dir end |
Instance Method Details
#resolve(document) ⇒ Object
Returns [entity_index, associations] where entity_index maps entity name → entity. ViewResolver consumes the index without rebuilding it.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lutaml/lml/import_resolver.rb', line 15 def resolve(document) @failures = [] entity_index = {} associations = [] visited = Set.new document.view_imports.each do |import| resolve_import(import.path, entity_index, associations, visited, @base_dir) end collect_local_entities(document, entity_index, associations) raise ImportError, @failures.join("\n") if @failures.any? [entity_index, associations] end |