Class: RuboCop::Cop::Ezcater::PrivateAttr
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Ezcater::PrivateAttr
- Defined in:
- lib/rubocop/cop/ezcater/private_attr.rb
Overview
This cop checks for the use of ‘attr_accessor`, `attr_reader`, `attr_writer` and `alias_method` after the access modifiers `private` and `protected` and requires the use of methods from the private_attr gem instead.
Constant Summary collapse
- ATTR_METHODS =
%i[attr_accessor attr_reader attr_writer].freeze
- ACCESS_AFFECTED_METHODS =
(ATTR_METHODS + %i[alias_method]).to_set.freeze
- MSG =
"Use `%s_%s` instead".freeze
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
47 48 49 |
# File 'lib/rubocop/cop/ezcater/private_attr.rb', line 47 def on_class(node) check_node(node.children[2]) # class body end |
#on_module(node) ⇒ Object
51 52 53 |
# File 'lib/rubocop/cop/ezcater/private_attr.rb', line 51 def on_module(node) check_node(node.children[1]) # module body end |