Sha256: 9bdb8ff5ceb8382ce4bfeb65e20f02e7d3f72ec254b115737ae9d7b12ad828c4

Contents?: true

Size: 630 Bytes

Versions: 3

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

module Synvert::Core
  # InsertAfterAction to insert code next to the node.
  class Rewriter::InsertAfterAction < 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

    # Indent of the node.
    #
    # @param node [Parser::AST::Node]
    # @return [String] n times whitesphace
    def indent(node)
      ' ' * node.indent
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
synvert-core-0.17.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.16.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.16.0 lib/synvert/core/rewriter/action/insert_after_action.rb