Sha256: ee0103baf505a8aa8e180f5fc9aa54013c94f0e0ebbb59d1732b50dc9af7c05b
Contents?: true
Size: 535 Bytes
Versions: 9
Compression:
Stored size: 535 Bytes
Contents
# encoding: utf-8 module RuboCop module Cop module Style # This cop checks for uses of Module#attr. class Attr < Cop MSG = 'Do not use `attr`. Use `attr_reader` instead.' def on_send(node) return unless command?(:attr, node) _receiver, _method_name, *args = *node add_offense(node, :selector) if args.any? end def autocorrect(node) ->(corrector) { corrector.replace(node.loc.selector, 'attr_reader') } end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems