class Architect::Diagram

Diagram is the base class for generating any diagram.

Public Instance Methods

draw(diagram, output = "class_diagram.svg", ext = 'svg') click to toggle source

Draw

diagram

string containing the markup of the diagram

# 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