class Rubocop::Cop::Style::DefWithParentheses
This cop checks for parentheses in the definition of a method, that does not take any arguments. Both instance and class/singleton methods are checked.
Constants
- MSG
Public Instance Methods
on_def(node)
click to toggle source
Calls superclass method
# File lib/rubocop/cop/style/def_parentheses.rb, line 13 def on_def(node) start_line = node.loc.keyword.line end_line = node.loc.end.line return if start_line == end_line _, args = *node if args.children == [] && args.loc.begin add_offence(:convention, args.loc.begin, MSG) end super end
on_defs(node)
click to toggle source
Calls superclass method
# File lib/rubocop/cop/style/def_parentheses.rb, line 27 def on_defs(node) start_line = node.loc.keyword.line end_line = node.loc.end.line return if start_line == end_line _, _, args = *node if args.children == [] && args.loc.begin add_offence(:convention, args.loc.begin, MSG) end super end