Module: Ea::Transformations
- Defined in:
- lib/ea/transformations.rb
Overview
Transformations is the legacy entry point for parse and to_uml. Both methods now delegate directly to Ea::Qea, Ea::Xmi, and Ea::Bridge — the per-format parsers and the UML bridge are reached without an intermediate engine layer.
Class Method Summary collapse
-
.parse(file_path, options = {}) ⇒ Object
Parse an EA file into its native representation.
-
.to_uml(path_or_model, options = {}) ⇒ Object
Transform an EA file (or pre-parsed model) into a
Lutaml::Uml::Document.
Class Method Details
.parse(file_path, options = {}) ⇒ Object
Parse an EA file into its native representation.
Pure entry point — does NOT require lutaml-uml. Returns:
.qea → Ea::Qea::Database
.xmi → Xmi::Sparx::Root
To get a Lutaml::Uml::Document instead, use to_uml.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ea/transformations.rb', line 17 def parse(file_path, = {}) ext = File.extname(file_path).downcase case ext when ".qea" Ea::Qea.load(file_path, [:config]) when ".xmi", ".xml" Ea::Xmi.load(file_path) else raise Ea::Error, "Unsupported file extension #{ext.inspect}. " \ "Supported: .qea, .xmi" end end |
.to_uml(path_or_model, options = {}) ⇒ Object
Transform an EA file (or pre-parsed model) into a
Lutaml::Uml::Document.
Bridge entry point — requires the optional lutaml-uml gem.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ea/transformations.rb', line 35 def to_uml(path_or_model, = {}) model = path_or_model.is_a?(String) ? parse(path_or_model, ) : path_or_model case model when Ea::Qea::Database Ea::Bridge::QeaToUml.transform(model, ) when ::Xmi::Sparx::Root Ea::Bridge::XmiToUml.transform(model) else raise Ea::Error, "Cannot transform #{model.class} to Lutaml::Uml::Document. " \ "Expected Ea::Qea::Database or Xmi::Sparx::Root." end end |