Class: Rubocop::Cop::Style::TrivialAccessors
- Defined in:
- lib/rubocop/cop/style/trivial_accessors.rb
Overview
This cop looks for trivial reader/writer methods, that could have been created with the attr_* family of functions automatically.
Constant Summary collapse
- MSG =
'Use attr_%s to define trivial %s methods.'
Instance Attribute Summary
Attributes inherited from Cop
#autocorrect, #corrections, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, lint?, #name, rails?, style?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_def(node) ⇒ Object
11 12 13 14 15 |
# File 'lib/rubocop/cop/style/trivial_accessors.rb', line 11 def on_def(node) method_name, args, body = *node check(node, method_name, args, body) end |
#on_defs(node) ⇒ Object
17 18 19 20 21 |
# File 'lib/rubocop/cop/style/trivial_accessors.rb', line 17 def on_defs(node) _scope, method_name, args, body = *node check(node, method_name, args, body) end |