Common functionality for cops checking for missing space after punctuation.
# File lib/rubocop/cop/mixin/space_after_punctuation.rb, line 25 def autocorrect(token) @corrections << lambda do |corrector| corrector.replace(token.pos, token.pos.source + ' ') end end
# File lib/rubocop/cop/mixin/space_after_punctuation.rb, line 9 def investigate(processed_source) processed_source.tokens.each_cons(2) do |t1, t2| next unless kind(t1) && t1.pos.line == t2.pos.line && t2.pos.column == t1.pos.column + offset && ![:tRPAREN, :tRBRACK].include?(t2.type) add_offense(t1, t1.pos, format(MSG, kind(t1))) end end
Generated with the Darkfish Rdoc Generator 2.