Class: Callgraphy::Registry

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

Overview

Records the information that describes a call graph.

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



5
6
7
# File 'lib/callgraphy/registry.rb', line 5

def initialize
  @registry = { public: [], private: [], callers: [], dependencies: [], calls: [] }
end

Instance Method Details

#all_callersObject



30
31
32
# File 'lib/callgraphy/registry.rb', line 30

def all_callers
  normalized :callers
end

#all_callsObject



26
27
28
# File 'lib/callgraphy/registry.rb', line 26

def all_calls
  normalized :calls
end

#all_dependenciesObject



34
35
36
# File 'lib/callgraphy/registry.rb', line 34

def all_dependencies
  normalized :dependencies
end

#all_private_methodsObject



22
23
24
# File 'lib/callgraphy/registry.rb', line 22

def all_private_methods
  normalized :private
end

#all_public_methodsObject



18
19
20
# File 'lib/callgraphy/registry.rb', line 18

def all_public_methods
  normalized :public
end

#register_call(caller, callee) ⇒ Object



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

def register_call(caller, callee)
  @registry.fetch(:calls).push([caller.to_s, callee.to_s])
end

#register_method(scope, caller) ⇒ Object Also known as: register_constant



9
10
11
# File 'lib/callgraphy/registry.rb', line 9

def register_method(scope, caller)
  @registry.fetch(scope).push(caller.to_s)
end