lib/reek/smells/class_variable.rb
#
# Collects the names of the class variables declared and/or used
# in the given module.
#
Collects the names of the class variables declared and/or used
in the given module.
Collects the names of the class variables declared and / or used in the given module .
def class_variables_in(ast)
        result = Hash.new { |hash, key| hash[key] = [] }
        collector = proc do |cvar_node|
          result[cvar_node.name].push(cvar_node.line)
        end
        [:cvar, :cvasgn, :cvdecl].each do |stmt_type|
          ast.each_node(stmt_type, [:class, :module], &collector)
        end
        result
      end
def class_variables_in ( ast ) result = Hash . new { | hash , key | hash [ key ] = [ ] } collector = proc do | cvar_node | result [ cvar_node . name ] . push ( cvar_node . line ) end [ :cvar , :cvasgn , :cvdecl ] . each do | stmt_type | ast . each_node ( stmt_type , [ :class , :module ] , & collector ) end result end
Collects the names of the class variables declared and/or used
in the given module.
Collects the names of the class variables declared and / or used in the given module .
ast
<not_specific>