Class: Architect::Diagram

Inherits:
Object
  • Object
show all
Defined in:
lib/architect/diagram.rb

Overview

Diagram is the base class for generating any diagram.

Instance Method Summary collapse

Instance Method Details

#draw(diagram, output = "class_diagram.svg", ext = 'svg') ⇒ Object

Draw

diagram

string containing the markup of the diagram



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/architect/diagram.rb', line 11

def draw(diagram, output = "class_diagram.svg", ext = 'svg')
  parser = Parser.new
  elements = parser.parse(diagram)
  graph = GraphViz.new("ClassDiagram", type: "digraph")
  graph.node["fillcolor"] = "lightgrey"
  graph.node["style"] = "filled"
  elements.each do |element|
    element.graph(graph)
  end
  graph.output(ext.to_sym => output, nothugly: true)
end