class Rubocop::Cop::Style::EmptyLineBetweenDefs

This cop checks whether method definitions are separated by empty lines.

Constants

MSG

Public Instance Methods

on_def(node) click to toggle source
Calls superclass method
# File lib/rubocop/cop/style/empty_line_between_defs.rb, line 11
def on_def(node)
  def_start = node.loc.keyword.line
  def_end = node.loc.end.line

  if @prev_def_end && (def_start - @prev_def_end) < 2
    add_offence(:convention, node.loc.keyword, MSG)
  end

  @prev_def_end = def_end

  super
end