class Rubocop::Cop::VariableInspector::VariableEntry

A VariableEntry represents existance of a local variable. This holds a variable declaration node, and some states of the variable.

Attributes

node[R]
used[RW]
used?[RW]

Public Class Methods

new(node) click to toggle source
# File lib/rubocop/cop/variable_inspector.rb, line 28
def initialize(node)
  unless VARIABLE_DECLARATION_TYPES.include?(node.type)
    fail ArgumentError,
         "Node type must be any of #{VARIABLE_DECLARATION_TYPES}, " +
         "passed #{node.type}"
  end
  @node = node
  @used = false
end

Public Instance Methods

name() click to toggle source
# File lib/rubocop/cop/variable_inspector.rb, line 38
def name
  @node.children.first
end