Sha256: c720ecbed50f7cae899319f60794735e118a78ff0b2c12a2ea2db65dcdf5630a

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

module Synvert::Core
  # AddAction to add code to the node.
  class Rewriter::AddAction < Rewriter::Action
    # Begin position to insert code.
    #
    # @return [Integer] begin position.
    def begin_pos
      @node.loc.expression.end_pos
    end

    # End position, always same to begin position.
    #
    # @return [Integer] end position.
    def end_pos
      begin_pos
    end

    private

    # The rewritten source code.
    #
    # @return [String] rewritten code.
    def rewritten_code
      rewritten_source
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
synvert-core-0.39.0 lib/synvert/core/rewriter/action/add_action.rb