Class: Suma::EengineConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/suma/eengine_converter.rb

Overview

Converts eengine comparison XML to Expressir::Changes::SchemaChange This is a thin wrapper around Expressir’s ChangesImportEengine command

Instance Method Summary collapse

Constructor Details

#initialize(xml_path, schema_name) ⇒ EengineConverter

Returns a new instance of EengineConverter.



9
10
11
12
13
# File 'lib/suma/eengine_converter.rb', line 9

def initialize(xml_path, schema_name)
  @xml_path = xml_path
  @schema_name = schema_name
  @xml_content = File.read(xml_path)
end

Instance Method Details

#convert(version:, existing_change_schema: nil) ⇒ Expressir::Changes::SchemaChange

Convert the eengine XML to a ChangeSchema

Parameters:

  • version (String)

    Version number for this change version

  • existing_change_schema (Expressir::Changes::SchemaChange, nil) (defaults to: nil)

    Existing schema to append to, or nil to create new

Returns:

  • (Expressir::Changes::SchemaChange)

    The updated change schema



21
22
23
24
25
26
27
28
29
30
# File 'lib/suma/eengine_converter.rb', line 21

def convert(version:, existing_change_schema: nil)
  # Use Expressir's built-in conversion which properly handles
  # HTML elements in descriptions
  Expressir::Commands::ChangesImportEengine.from_xml(
    @xml_content,
    @schema_name,
    version,
    existing_schema: existing_change_schema,
  )
end