Sha256: 3ae953308a46cfc2a1b1a2718a0f9b1e39b9502b03bbc0355db83739ba52fb68

Contents?: true

Size: 618 Bytes

Versions: 16

Compression:

Stored size: 618 Bytes

Contents

# encoding: utf-8

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

16 entries across 16 versions & 1 rubygems

Version Path
synvert-core-0.15.2 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.15.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.15.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.14.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.13.2 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.13.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.13.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.12.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.11.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.11.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.10.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.9.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.9.0 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.8.2 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.8.1 lib/synvert/core/rewriter/action/insert_after_action.rb
synvert-core-0.8.0 lib/synvert/core/rewriter/action/insert_after_action.rb