Sha256: f4118d93c0f315851610474c01bdde260b3a2f3d9ca3c904022aa844dba60151

Contents?: true

Size: 733 Bytes

Versions: 4

Compression:

Stored size: 733 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module VariableInspector
      # This class represents each reference of a variable.
      class Reference
        include Locatable

        VARIABLE_REFERENCE_TYPES = (
          [VARIABLE_REFERENCE_TYPE] +
          OPERATOR_ASSIGNMENT_TYPES +
          [ZERO_ARITY_SUPER_TYPE]
        ).freeze

        attr_reader :node, :scope

        def initialize(node, scope)
          unless VARIABLE_REFERENCE_TYPES.include?(node.type)
            fail ArgumentError,
                 "Node type must be any of #{VARIABLE_REFERENCE_TYPES}, " \
                 "passed #{node.type}"
          end

          @node = node
          @scope = scope
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.20.1 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.20.0 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.19.1 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.19.0 lib/rubocop/cop/variable_inspector/reference.rb