class RuboCop::Cop::PunctuationCorrector

This autocorrects punctuation

Public Class Methods

add_space(corrector, token) click to toggle source
# File lib/rubocop/cop/correctors/punctuation_corrector.rb, line 12
def add_space(corrector, token)
  corrector.replace(token.pos, "#{token.pos.source} ")
end
remove_space(corrector, space_before) click to toggle source
# File lib/rubocop/cop/correctors/punctuation_corrector.rb, line 8
def remove_space(corrector, space_before)
  corrector.remove(space_before)
end
swap_comma(corrector, range) click to toggle source
# File lib/rubocop/cop/correctors/punctuation_corrector.rb, line 16
def swap_comma(corrector, range)
  return unless range

  case range.source
  when ',' then corrector.remove(range)
  else          corrector.insert_after(range, ',')
  end
end