Module: Ea::Sources::Qea::IdNormalizer

Defined in:
lib/ea/sources/qea/id_normalizer.rb

Overview

Normalizes EA's identifier formats into stable strings used as Ea::Model element ids. EA represents identity as {GUID} strings.

Two output formats:

  • from_guid — bare GUID without braces (canonical model id)
  • to_eaidEAID_<guid with dashes-to-underscores> matching the reference SVG filename convention

Class Method Summary collapse

Class Method Details

.from_guid(ea_guid) ⇒ Object



17
18
19
20
21
# File 'lib/ea/sources/qea/id_normalizer.rb', line 17

def from_guid(ea_guid)
  return nil if ea_guid.nil? || ea_guid.empty?

  ea_guid.to_s.gsub(/[{}]/, "")
end

.synthetic(prefix, *parts) ⇒ Object



32
33
34
# File 'lib/ea/sources/qea/id_normalizer.rb', line 32

def synthetic(prefix, *parts)
  "#{prefix}:#{parts.join(":")}"
end

.to_eaid(ea_guid) ⇒ Object

Convert a GUID to the EAID_ filename format used by EA's SVG export: strip braces, replace dashes with underscores, prefix with EAID_.



26
27
28
29
30
# File 'lib/ea/sources/qea/id_normalizer.rb', line 26

def to_eaid(ea_guid)
  return nil if ea_guid.nil? || ea_guid.empty?

  "EAID_" + ea_guid.to_s.gsub(/[{}]/, "").tr("-", "_")
end