Sha256: 0c288fffda05c65323caf9b17aa7dc03dd17c015a077ae62b21021854878577f

Contents?: true

Size: 632 Bytes

Versions: 52

Compression:

Stored size: 632 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

52 entries across 52 versions & 1 rubygems

Version Path
synvert-core-0.51.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.51.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.50.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.49.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.49.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.48.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.47.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.46.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.45.2 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.45.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.45.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.44.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.44.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.42.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.42.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.41.2 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.41.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.41.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.40.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.39.0 lib/synvert/core/rewriter/action/insert_after_action.rb