Class: Ea::Export::PlantUml::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/export/plantuml/generator.rb

Overview

Generates PlantUML class diagram text from a parsed QEA model.

Example output:

@startuml
class Person {
+name: String
+age: Integer
}
Person "1" --> "0..*" Address : lives_at
@enduml

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Generator

Returns a new instance of Generator.



23
24
25
# File 'lib/ea/export/plantuml/generator.rb', line 23

def initialize(model)
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



21
22
23
# File 'lib/ea/export/plantuml/generator.rb', line 21

def model
  @model
end

Class Method Details

.call(model, **_opts) ⇒ Object



17
18
19
# File 'lib/ea/export/plantuml/generator.rb', line 17

def self.call(model, **_opts)
  new(model).call
end

Instance Method Details

#callObject



27
28
29
30
31
32
33
# File 'lib/ea/export/plantuml/generator.rb', line 27

def call
  lines = ["@startuml"]
  lines.concat(class_lines)
  lines.concat(connector_lines)
  lines << "@enduml"
  lines.join("\n") + "\n"
end