Class: Rubocop::Cop::SingleLineMethods

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/single_line_methods.rb

Constant Summary collapse

MSG =
'Avoid single-line method definitions.'

Instance Attribute Summary

Attributes inherited from Cop

#debug, #disabled_lines, #offences

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, cop_name, #has_report?, #ignore_node, inherited, #initialize, #inspect, #name, #on_comment

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#allow_empty?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rubocop/cop/single_line_methods.rb', line 8

def allow_empty?
  SingleLineMethods.config['AllowIfMethodIsEmpty']
end

#on_def(node) ⇒ Object



12
13
14
15
16
# File 'lib/rubocop/cop/single_line_methods.rb', line 12

def on_def(node)
  check(node)

  super
end

#on_defs(node) ⇒ Object



18
19
20
21
22
# File 'lib/rubocop/cop/single_line_methods.rb', line 18

def on_defs(node)
  check(node)

  super
end