Class: Callgraphy::Registry
- Inherits:
-
Object
- Object
- Callgraphy::Registry
- Defined in:
- lib/callgraphy/registry.rb
Overview
Records the information that describes a call graph.
Instance Method Summary collapse
- #all_callers ⇒ Object
- #all_calls ⇒ Object
- #all_dependencies ⇒ Object
- #all_private_methods ⇒ Object
- #all_public_methods ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #register_call(caller, callee) ⇒ Object
- #register_method(scope, caller) ⇒ Object (also: #register_constant)
Constructor Details
#initialize ⇒ Registry
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_callers ⇒ Object
30 31 32 |
# File 'lib/callgraphy/registry.rb', line 30 def all_callers normalized :callers end |
#all_calls ⇒ Object
26 27 28 |
# File 'lib/callgraphy/registry.rb', line 26 def all_calls normalized :calls end |
#all_dependencies ⇒ Object
34 35 36 |
# File 'lib/callgraphy/registry.rb', line 34 def all_dependencies normalized :dependencies end |
#all_private_methods ⇒ Object
22 23 24 |
# File 'lib/callgraphy/registry.rb', line 22 def all_private_methods normalized :private end |
#all_public_methods ⇒ Object
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 |