Class: Lutaml::Qea::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/qea/parser.rb

Overview

Parser class provides backward compatibility wrapper for Qea.parse

This class exists for compatibility with older code that uses Qea::Parser.parse instead of the newer Qea.parse method.

For validation use cases, this returns both database and document. For simple parsing, use Qea.parse directly which returns just document.

Examples:

Parse a QEA file for validation

result = Lutaml::Qea::Parser.new.parse("model.qea")
document = result[:document]
database = result[:database]

See Also:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(qea_path, options = {}) ⇒ Lutaml::Uml::Document

Parse a QEA file and return document only

This is a backward compatibility wrapper that delegates to Qea.parse

Parameters:

  • qea_path (String)

    Path to the .qea file

  • options (Hash) (defaults to: {})

    Transformation options

Returns:

See Also:



34
35
36
# File 'lib/lutaml/qea/parser.rb', line 34

def parse(qea_path, options = {})
  Qea.parse(qea_path, options)
end

Instance Method Details

#parse(qea_path, options = {}) ⇒ Hash

Instance method for compatibility with test expectations

Parameters:

  • qea_path (String)

    Path to the .qea file

  • options (Hash) (defaults to: {})

    Transformation options

Returns:

  • (Hash)

    Hash with :database and :document keys



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/lutaml/qea/parser.rb', line 43

def parse(qea_path, options = {}) # rubocop:disable Metrics/MethodLength
  # Load database
  config = options[:config]
  loader = Services::DatabaseLoader.new(qea_path, config)
  database = loader.load

  # Create document
  factory = Factory::EaToUmlFactory.new(database, options)
  document = factory.create_document

  # Return both for validation support
  {
    database: database,
    document: document,
  }
end