Class: Ea::Sources::Qea::DiagramBuilder
- Inherits:
-
Object
- Object
- Ea::Sources::Qea::DiagramBuilder
- Defined in:
- lib/ea/sources/qea/diagram_builder.rb
Overview
Translates EA t_diagram + t_diagramlinks + t_diagramobjects into Ea::Model::Diagram with placed DiagramElements and DiagramConnectors (including pixel coordinates and parsed styles).
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
Instance Method Summary collapse
- #build_all ⇒ Object
- #build_one(diagram_row) ⇒ Object
-
#initialize(database) ⇒ DiagramBuilder
constructor
A new instance of DiagramBuilder.
Constructor Details
#initialize(database) ⇒ DiagramBuilder
Returns a new instance of DiagramBuilder.
13 14 15 |
# File 'lib/ea/sources/qea/diagram_builder.rb', line 13 def initialize(database) @database = database end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
11 12 13 |
# File 'lib/ea/sources/qea/diagram_builder.rb', line 11 def database @database end |
Instance Method Details
#build_all ⇒ Object
17 18 19 20 |
# File 'lib/ea/sources/qea/diagram_builder.rb', line 17 def build_all diagrams = database.collections[:diagrams] || [] diagrams.map { |row| build_one(row) } end |
#build_one(diagram_row) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ea/sources/qea/diagram_builder.rb', line 22 def build_one(diagram_row) Ea::Model::Diagram.new( id: IdNormalizer.from_guid(diagram_row.ea_guid), name: diagram_row.name, package_id: package_id_for(diagram_row), diagram_type: diagram_row.diagram_type, bounds: bounds_for(diagram_row), elements: build_elements(diagram_row), connectors: build_connectors(diagram_row), annotations: AnnotationBuilder.from_note(diagram_row.notes, diagram_row.ea_guid, kind: "documentation") ) end |