Class: Callgraphy::CallGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/callgraphy/call_graph.rb

Overview

Knows how to graph the target class call graph given the specified registry.

Constant Summary collapse

NODE_OPTIONS =
{
  public: { style: "filled", fillcolor: "palegreen" },
  private: {},
  callers: { style: "filled", fillcolor: "lightblue" },
  dependencies: { style: "filled", fillcolor: "lightcoral" }
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, output_directory, registry) ⇒ CallGraph

Returns a new instance of CallGraph.



20
21
22
23
24
25
26
# File 'lib/callgraphy/call_graph.rb', line 20

def initialize(target, output_directory, registry)
  @target = target
  @output_directory = output_directory
  @registry = registry

  @nodes = {}
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



14
15
16
# File 'lib/callgraphy/call_graph.rb', line 14

def registry
  @registry
end

Class Method Details

.draw(target, output_directory, registry) ⇒ Object



16
17
18
# File 'lib/callgraphy/call_graph.rb', line 16

def self.draw(target, output_directory, registry)
  new(target, output_directory, registry).draw
end

Instance Method Details

#drawObject



28
29
30
31
32
33
34
# File 'lib/callgraphy/call_graph.rb', line 28

def draw
  add_methods
  add_constants
  add_calls

  generate_graph
end