123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::Cop::EmptyLineCorrector

Relationships & Source Files
Inherits: Object
Defined in: lib/rubocop/cop/correctors/empty_line_corrector.rb

Overview

This class does empty line autocorrection

Class Method Summary

Class Method Details

.correct(corrector, node)

[ GitHub ]

  
# File 'lib/rubocop/cop/correctors/empty_line_corrector.rb', line 8

def correct(corrector, node)
  offense_style, range = node

  case offense_style
  when :no_empty_lines
    corrector.remove(range)
  when :empty_lines
    corrector.insert_before(range, "\n")
  end
end

.insert_before(corrector, node)

[ GitHub ]

  
# File 'lib/rubocop/cop/correctors/empty_line_corrector.rb', line 19

def insert_before(corrector, node)
  corrector.insert_before(node, "\n")
end