Sha256: ef5111cd70d9b47b4fbfe70f2c805c4311f803e89f7fdc3cd65dc227b3033c15

Contents?: true

Size: 733 Bytes

Versions: 9

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

9 entries across 9 versions & 1 rubygems

Version Path
rubocop-0.18.1 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.18.0 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.17.0 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.16.0 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.15.0 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.14.1 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.14.0 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.13.1 lib/rubocop/cop/variable_inspector/reference.rb
rubocop-0.13.0 lib/rubocop/cop/variable_inspector/reference.rb