Class: Pipely::GraphBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pipely/graph_builder.rb

Overview

Builds a GraphViz graph from a set of Components and their Dependencies

Instance Method Summary collapse

Constructor Details

#initialize(graph = nil) ⇒ GraphBuilder

Returns a new instance of GraphBuilder.



9
10
11
# File 'lib/pipely/graph_builder.rb', line 9

def initialize(graph=nil)
  @graph = graph || GraphViz.new(:G, :type => :digraph)
end

Instance Method Details

#build(components) ⇒ Object



13
14
15
16
17
# File 'lib/pipely/graph_builder.rb', line 13

def build(components)
  add_nodes(components)
  add_edges(components)
  @graph
end