Sha256: 2a2c77cfc1367613c740085626c6ba431f37bcad823875d164d7643fe9815a45
Contents?: true
Size: 685 Bytes
Versions: 2
Compression:
Stored size: 685 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop # This auto-corrects punctuation class PunctuationCorrector class << self def remove_space(space_before) ->(corrector) { corrector.remove(space_before) } end def add_space(token) ->(corrector) { corrector.replace(token.pos, "#{token.pos.source} ") } end def swap_comma(range) return unless range lambda do |corrector| case range.source when ',' then corrector.remove(range) else corrector.insert_after(range, ',') end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.89.1 | lib/rubocop/cop/correctors/punctuation_corrector.rb |
rubocop-0.89.0 | lib/rubocop/cop/correctors/punctuation_corrector.rb |