class RuboCop::Cop::EmptyLineCorrector

This class does empty line auto-correction

Public Class Methods

correct(node) click to toggle source
# File lib/rubocop/cop/correctors/empty_line_corrector.rb, line 8
def correct(node)
  offense_style, range = node
  lambda do |corrector|
    case offense_style
    when :no_empty_lines then
      corrector.remove(range)
    when :empty_lines then
      corrector.insert_before(range, "\n")
    end
  end
end
insert_before(node) click to toggle source
# File lib/rubocop/cop/correctors/empty_line_corrector.rb, line 20
def insert_before(node)
  ->(corrector) { corrector.insert_before(node.source_range, "\n") }
end