Class: DependencyGrapher::Method
- Inherits:
-
Object
- Object
- DependencyGrapher::Method
- Includes:
- SerializeHelpers
- Defined in:
- lib/dependency_grapher/method.rb
Constant Summary collapse
- Limit =
50
Instance Attribute Summary collapse
-
#defined_class ⇒ Object
readonly
Returns the value of attribute defined_class.
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
-
#method_id ⇒ Object
readonly
Returns the value of attribute method_id.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#types ⇒ Object
TODO Fix LOD violation (types should not be directly exposed).
Instance Method Summary collapse
- #ancestors ⇒ Object
- #full_path ⇒ Object
- #id ⇒ Object
-
#initialize(defined_class, method_id, path, lineno) ⇒ Method
constructor
A new instance of Method.
- #leaf ⇒ Object
- #root ⇒ Object
Constructor Details
#initialize(defined_class, method_id, path, lineno) ⇒ Method
Returns a new instance of Method.
16 17 18 19 20 21 22 23 24 |
# File 'lib/dependency_grapher/method.rb', line 16 def initialize(defined_class, method_id, path, lineno) # Truncate class name to limit characters if too long defined_class = defined_class[0,Limit] + "..." if defined_class.length > Limit @defined_class = defined_class @method_id = method_id @path = path @lineno = lineno @types = Set.new end |
Instance Attribute Details
#defined_class ⇒ Object (readonly)
Returns the value of attribute defined_class.
11 12 13 |
# File 'lib/dependency_grapher/method.rb', line 11 def defined_class @defined_class end |
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
11 12 13 |
# File 'lib/dependency_grapher/method.rb', line 11 def lineno @lineno end |
#method_id ⇒ Object (readonly)
Returns the value of attribute method_id.
11 12 13 |
# File 'lib/dependency_grapher/method.rb', line 11 def method_id @method_id end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/dependency_grapher/method.rb', line 11 def path @path end |
#types ⇒ Object
TODO Fix LOD violation (types should not be directly exposed)
14 15 16 |
# File 'lib/dependency_grapher/method.rb', line 14 def types @types end |
Instance Method Details
#ancestors ⇒ Object
30 31 32 33 |
# File 'lib/dependency_grapher/method.rb', line 30 def ancestors binding.pry if @defined_class.nil? @defined_class.split("::") end |
#full_path ⇒ Object
26 27 28 |
# File 'lib/dependency_grapher/method.rb', line 26 def full_path @path + ":" + @lineno end |
#id ⇒ Object
43 44 45 |
# File 'lib/dependency_grapher/method.rb', line 43 def id @defined_class + @method_id end |
#leaf ⇒ Object
39 40 41 |
# File 'lib/dependency_grapher/method.rb', line 39 def leaf ancestors.last end |
#root ⇒ Object
35 36 37 |
# File 'lib/dependency_grapher/method.rb', line 35 def root ancestors.first end |