Class: Callgraphy::Definition
- Inherits:
-
Object
- Object
- Callgraphy::Definition
- Defined in:
- lib/callgraphy/definition.rb
Overview
Exposes a DSL to describe call graphs for a target class.
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Class Method Summary collapse
Instance Method Summary collapse
- #constants_to_graph(constant_scope, calls = {}) ⇒ Object
-
#initialize(registry) ⇒ Definition
constructor
A new instance of Definition.
- #methods_to_graph(method_scope, calls = {}) ⇒ Object
Constructor Details
#initialize(registry) ⇒ Definition
Returns a new instance of Definition.
13 14 15 |
# File 'lib/callgraphy/definition.rb', line 13 def initialize(registry) @registry = registry end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
5 6 7 |
# File 'lib/callgraphy/definition.rb', line 5 def registry @registry end |
Class Method Details
.register(&block) ⇒ Object
7 8 9 10 11 |
# File 'lib/callgraphy/definition.rb', line 7 def self.register(&block) definition = Definition.new(Registry.new) definition.instance_eval(&block) definition.registry end |
Instance Method Details
#constants_to_graph(constant_scope, calls = {}) ⇒ Object
22 23 24 25 |
# File 'lib/callgraphy/definition.rb', line 22 def constants_to_graph(constant_scope, calls = {}) validate_scope(constant_scope, :callers, :dependencies) register_constants_to_graph(constant_scope, calls) end |
#methods_to_graph(method_scope, calls = {}) ⇒ Object
17 18 19 20 |
# File 'lib/callgraphy/definition.rb', line 17 def methods_to_graph(method_scope, calls = {}) validate_scope(method_scope, :public, :private) register_methods_to_graph(method_scope, calls) end |