class Reek::AST::ReferenceCollector
Locates references to the current object within a portion of an abstract syntax tree.
Attributes
Public Class Methods
Source
# File lib/reek/ast/reference_collector.rb, line 10 def initialize(ast) @ast = ast end
Public Instance Methods
Source
# File lib/reek/ast/reference_collector.rb, line 14 def num_refs_to_self (explicit_self_calls.to_a + implicit_self_calls.to_a).size end
Private Instance Methods
Source
# File lib/reek/ast/reference_collector.rb, line 22 def explicit_self_calls ast.each_node([:self, :super, :zsuper, :ivar, :ivasgn]) end
Source
# File lib/reek/ast/reference_collector.rb, line 26 def implicit_self_calls ast.each_node(:send).reject(&:receiver) end