Class: Ea::Export::Xmi::Generator
- Inherits:
-
Object
- Object
- Ea::Export::Xmi::Generator
- Defined in:
- lib/ea/export/xmi/generator.rb
Overview
Generates Sparx-flavored XMI 2.1 from a parsed QEA model.
Uses the existing QEA→XMI transformer under Ea::Transformers when available. Falls back to a minimal hand-rolled writer that produces a valid XMI root + class list when the bridge is unavailable.
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(model) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(model) ⇒ Generator
Returns a new instance of Generator.
22 23 24 |
# File 'lib/ea/export/xmi/generator.rb', line 22 def initialize(model) @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
19 20 21 |
# File 'lib/ea/export/xmi/generator.rb', line 19 def model @model end |
Class Method Details
.call(model, **_opts) ⇒ Object
15 16 17 |
# File 'lib/ea/export/xmi/generator.rb', line 15 def self.call(model, **_opts) new(model).call end |
Instance Method Details
#call ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ea/export/xmi/generator.rb', line 26 def call builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml| xml.xmi("XMI" => "2.1", "xmlns:UML" => "http://schema.omg.org/spec/UML/2.1", "xmlns:xmi" => "http://schema.omg.org/spec/XMI/2.1") do xml.documentation(:exporter => "ea-rb", :exporterVersion => Ea::VERSION) emit_model(xml) end end builder.to_xml end |