class DependencyGrapher::Method

Constants

Limit

Attributes

defined_class[R]
lineno[R]
method_id[R]
path[R]
types[RW]

TODO Fix LOD violation (types should not be directly exposed)

Public Class Methods

new(defined_class, method_id, path, lineno) click to toggle source
# 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

Public Instance Methods

ancestors() click to toggle source
# File lib/dependency_grapher/method.rb, line 30
def ancestors
  binding.pry if @defined_class.nil?
  @defined_class.split("::")
end
full_path() click to toggle source
# File lib/dependency_grapher/method.rb, line 26
def full_path
  @path + ":" + @lineno
end
id() click to toggle source
# File lib/dependency_grapher/method.rb, line 43
def id
  @defined_class + @method_id
end
leaf() click to toggle source
# File lib/dependency_grapher/method.rb, line 39
def leaf
  ancestors.last
end
root() click to toggle source
# File lib/dependency_grapher/method.rb, line 35
def root
  ancestors.first
end