Parent

Class/Module Index [+]

Quicksearch

Reek::Source::ReferenceCollector

Locates references to the current object within a portion of an abstract syntax tree.

Constants

STOP_NODES

Public Class Methods

new(ast) click to toggle source
# File lib/reek/source/reference_collector.rb, line 12
def initialize(ast)
  @ast = ast
end

Public Instance Methods

num_refs_to_self() click to toggle source
# File lib/reek/source/reference_collector.rb, line 16
def num_refs_to_self
  result = 0
  [:self, :zsuper, :ivar, :iasgn].each do |node_type|
    @ast.look_for(node_type, STOP_NODES) { result += 1}
  end
  @ast.look_for(:call, STOP_NODES) do |call|
    result += 1 unless call.receiver
  end
  result
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.