Sha256: a4ed3bd95789ec0149b172ee9abb6cd89fca3b2c91686e73785e3c82e48401ee

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cop checks for uses of class variables. Offenses
      # are signaled only on assignment to class variables to
      # reduced the number of offenses that would be reported.
      class ClassVars < Cop
        MSG = 'Replace class var %s with a class instance var.'

        def on_cvasgn(node)
          add_offense(node, :name)
        end

        def message(node)
          class_var, = *node
          MSG.format(class_var)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.19.1 lib/rubocop/cop/style/class_vars.rb
rubocop-0.19.0 lib/rubocop/cop/style/class_vars.rb