Class: Rubocop::Cop::Style::SingleLineMethods
- Defined in:
- lib/rubocop/cop/style/single_line_methods.rb
Overview
This cop checks for single-line method definitions. It can optionally accept single-line methods with no body.
Constant Summary collapse
- MSG =
'Avoid single-line method definitions.'
Constants inherited from Cop
Instance Attribute Summary
Attributes inherited from Cop
#config, #corrections, #offences, #processed_source
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#allow_empty? ⇒ Boolean
11 12 13 |
# File 'lib/rubocop/cop/style/single_line_methods.rb', line 11 def allow_empty? cop_config['AllowIfMethodIsEmpty'] end |
#on_def(node) ⇒ Object
15 16 17 |
# File 'lib/rubocop/cop/style/single_line_methods.rb', line 15 def on_def(node) check(node) end |
#on_defs(node) ⇒ Object
19 20 21 |
# File 'lib/rubocop/cop/style/single_line_methods.rb', line 19 def on_defs(node) check(node) end |