Sha256: c2d2a5d7eedf4c4c9f360eed60eba123cabc3ba50b67225381bc1f9f99d38a5c
Contents?: true
Size: 743 Bytes
Versions: 7
Compression:
Stored size: 743 Bytes
Contents
# frozen_string_literal: true module Synvert::Core # InsertAction to add code to the node. class Rewriter::InsertAction < Rewriter::Action def initialize(instance, code, at:) super(instance, code) @at = at end # Begin position to insert code. # # @return [Integer] begin position. def begin_pos if @at == 'end' @node.loc.expression.end_pos else @node.loc.expression.begin_pos end end # End position, always same to begin position. # # @return [Integer] end position. def end_pos begin_pos end # The rewritten source code. # # @return [String] rewritten code. def rewritten_code rewritten_source end end end
Version data entries
7 entries across 7 versions & 1 rubygems