Sha256: 2a68136426a331586818d4ee6c2d2d704a7e76a535b31f034c9c01ef5f38b4ea
Contents?: true
Size: 606 Bytes
Versions: 15
Compression:
Stored size: 606 Bytes
Contents
module Reek module Source # # Locates references to the current object within a portion # of an abstract syntax tree. # class ReferenceCollector STOP_NODES = [:class, :module, :def, :defs] def initialize(ast) @ast = ast end def num_refs_to_self result = 0 [:self, :zsuper, :ivar, :ivasgn].each do |node_type| @ast.look_for(node_type, STOP_NODES) { result += 1 } end @ast.look_for(:send, STOP_NODES) do |call| result += 1 unless call.receiver end result end end end end
Version data entries
15 entries across 15 versions & 1 rubygems