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)
result = Executor.run(doc, compiled: compiled)
result.instances  # array of hydrated instance objects
result.errors     # array of validation error strings

Defined Under Namespace

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiled:) ⇒ Executor

Returns a new instance of Executor.



40
41
42
# File 'lib/lutaml/lml/executor.rb', line 40

def initialize(compiled:)
  @compiled = compiled
end

Instance Attribute Details

#compiledObject (readonly)

Returns the value of attribute compiled.



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

def compiled
  @compiled
end

Class Method Details

.run(doc, compiled:) ⇒ Object

Run the full import/validate/export cycle on a parsed document. Returns a Result with hydrated instances and validation errors.



46
47
48
# File 'lib/lutaml/lml/executor.rb', line 46

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

Instance Method Details

#run(doc) ⇒ Object



50
51
52
53
54
55
# File 'lib/lutaml/lml/executor.rb', line 50

def run(doc)
  instances = run_imports(doc)
  errors = validate_collections(doc, instances)
  run_exports(doc, instances)
  Result.new(instances, errors)
end