Class: Lutaml::Lml::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/lml/executor.rb,
lib/lutaml/lml/executor/csv_adapter.rb,
lib/lutaml/lml/executor/xml_adapter.rb,
lib/lutaml/lml/executor/format_adapter.rb,
lib/lutaml/lml/executor/adapter_helpers.rb,
lib/lutaml/lml/executor/condition_evaluator.rb

Overview

Orchestrates instance data I/O: import external data, validate collections, and export to external formats.

Format-specific I/O is delegated to registered adapters via the FormatAdapter registry. The core executor only handles the orchestration — it knows what to do, adapters know how.

Usage:

compiled = ModelCompiler.new.compile(models_file)
doc = Pipeline.call(instances_file, resolve: false)
instances = Executor.run(doc, compiled: compiled)

Defined Under Namespace

Modules: AdapterHelpers, FormatAdapter Classes: ConditionEvaluator, CsvAdapter, XmlAdapter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiled:) ⇒ Executor

Returns a new instance of Executor.



26
27
28
# File 'lib/lutaml/lml/executor.rb', line 26

def initialize(compiled:)
  @compiled = compiled
end

Instance Attribute Details

#compiledObject (readonly)

Returns the value of attribute compiled.



24
25
26
# File 'lib/lutaml/lml/executor.rb', line 24

def compiled
  @compiled
end

Class Method Details

.run(doc, compiled:) ⇒ Object

Run the full import/validate/export cycle on a parsed document. Returns an array of hydrated instance objects.



32
33
34
# File 'lib/lutaml/lml/executor.rb', line 32

def self.run(doc, compiled:)
  new(compiled: compiled).run(doc)
end

Instance Method Details

#run(doc) ⇒ Object



36
37
38
39
40
41
# File 'lib/lutaml/lml/executor.rb', line 36

def run(doc)
  instances = run_imports(doc)
  validate_collections(doc, instances)
  run_exports(doc, instances)
  instances
end