class GraphManager
Public Class Methods
new(options)
click to toggle source
# File lib/graph_manager.rb, line 5 def initialize(options) @stack = ["start"] @edges = [] @options = options @g = GraphViz.new(:G, :type => :digraph) @g.add_node("start") end
Public Instance Methods
add_edges(event)
click to toggle source
# File lib/graph_manager.rb, line 15 def add_edges(event) node = get_node_name(event) edge = [@stack.last, node] @stack << node return if @edges.include?(edge) @edges << edge @g.add_edge(*@edges.last) end
get_node_name(event)
click to toggle source
# File lib/graph_manager.rb, line 27 def get_node_name(event) if @options[:show_path] "#{event.defined_class}##{event.method_id}\n#{event.path}".freeze else "#{event.defined_class}##{event.method_id}".freeze end end
node_count()
click to toggle source
# File lib/graph_manager.rb, line 39 def node_count @g.node_count end
output(*args)
click to toggle source
# File lib/graph_manager.rb, line 35 def output(*args) @g.output(*args) end
pop()
click to toggle source
# File lib/graph_manager.rb, line 43 def pop @stack.pop end