Class: Kefka::LineGraph

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/kefka.rb

Overview

shows which line in a method called which method

Instance Method Summary collapse

Constructor Details

#initializeLineGraph

Returns a new instance of LineGraph.



151
152
153
# File 'lib/kefka.rb', line 151

def initialize
  @graph =  RGL::DirectedAdjacencyGraph.new
end

Instance Method Details

#add_edge(u, v) ⇒ Object

Raises:

  • (ArgumentError)


155
156
157
158
# File 'lib/kefka.rb', line 155

def add_edge(u,v)
  raise ArgumentError unless Call === u && Method === v
  @graph.add_edge(u,v)
end

#edgesObject



160
161
162
163
164
165
166
167
# File 'lib/kefka.rb', line 160

def edges
  @graph.edges.map { |edge|
    {
      :source => edge.source.key,
      :target => edge.target.key
    }
  }
end