Class: Suma::EengineConverter

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

Overview

Converts eengine comparison XML to Expressir::Changes::SchemaChange.

Pure converter: takes XML content as a string (no I/O). The caller is responsible for reading the file. This keeps the object cheap to construct and easy to test in isolation — no fixture file required just to instantiate.

Instance Method Summary collapse

Constructor Details

#initialize(schema_name, xml_content) ⇒ EengineConverter

Returns a new instance of EengineConverter.



13
14
15
16
# File 'lib/suma/eengine_converter.rb', line 13

def initialize(schema_name, xml_content)
  @schema_name = schema_name
  @xml_content = xml_content
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



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

def convert(version:, existing_change_schema: nil)
  Expressir::Commands::ChangesImportEengine.from_xml(
    @xml_content,
    @schema_name,
    version,
    existing_schema: existing_change_schema,
  )
end