Sha256: af6f145f6d93a1679a94ddc8b3a9ccb771c9b89e8b9ae77fca4b5190d5e044c8

Contents?: true

Size: 483 Bytes

Versions: 13

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

# InsertAfterAction to insert code next to the node.
class NodeMutation::InsertAfterAction < NodeMutation::Action
  private

  # Calculate the begin and end positions.
  def calculate_position
    @start = NodeMutation.adapter.get_end(@node)
    @end = @start
  end

  # Indent of the node.
  #
  # @param node [Parser::AST::Node]
  # @return [Integer] indent size
  def indent(node)
    ' ' * NodeMutation.adapter.get_start_loc(node).column
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
node_mutation-1.4.4 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.4.3 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.4.2 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.4.1 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.4.0 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.3.3 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.3.2 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.3.1 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.3.0 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.2.1 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.2.0 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.1.0 lib/node_mutation/action/insert_after_action.rb
node_mutation-1.0.0 lib/node_mutation/action/insert_after_action.rb