Class: Kefka::MethodGraph
- Inherits:
-
Object
- Object
- Kefka::MethodGraph
- Extended by:
- Forwardable
- Defined in:
- lib/kefka.rb
Overview
shows which method called which method
Instance Method Summary collapse
- #add_edge(u, v) ⇒ Object
- #assign_depth(u, v) ⇒ Object
-
#initialize ⇒ MethodGraph
constructor
A new instance of MethodGraph.
Constructor Details
#initialize ⇒ MethodGraph
Returns a new instance of MethodGraph.
130 131 132 |
# File 'lib/kefka.rb', line 130 def initialize @graph = RGL::DirectedAdjacencyGraph.new end |
Instance Method Details
#add_edge(u, v) ⇒ Object
139 140 141 142 143 |
# File 'lib/kefka.rb', line 139 def add_edge(u,v) raise ArgumentError unless Method === u && Method === v assign_depth(u,v) @graph.add_edge(u,v) end |
#assign_depth(u, v) ⇒ Object
134 135 136 137 |
# File 'lib/kefka.rb', line 134 def assign_depth(u,v) u.depth = 0 unless u.depth v.depth = u.depth + 1 end |