Sha256: 990d0cdb4fbdec0625d588686737692ce5716ca933acd3c349d2e773cbaa51d3
Contents?: true
Size: 696 Bytes
Versions: 11
Compression:
Stored size: 696 Bytes
Contents
module Parser class Rewriter < Parser::AST::Processor def rewrite(source_buffer, ast) @source_rewriter = Source::Rewriter.new(source_buffer) process(ast) @source_rewriter.process end private def assignment?(node) [:lvasgn, :ivasgn, :gvasgn, :cvasgn, :casgn].include?(node.type) end def remove(range) @source_rewriter.remove(range) end def insert_before(range, content) @source_rewriter.insert_before(range, content) end def insert_after(range, content) @source_rewriter.insert_after(range, content) end def replace(range, content) @source_rewriter.replace(range, content) end end end
Version data entries
11 entries across 11 versions & 1 rubygems