Class: Synvert::Core::Rewriter::AppendAction

Inherits:
Action
  • Object
show all
Defined in:
lib/synvert/core/rewriter/action/append_action.rb

Overview

AppendAction to append code to the bottom of node body.

Constant Summary collapse

END_LENGTH =
"\nend".length

Constants inherited from Action

Synvert::Core::Rewriter::Action::DEFAULT_INDENT

Instance Attribute Summary

Attributes inherited from Action

#begin_pos, #end_pos

Instance Method Summary collapse

Methods inherited from Action

#initialize, #line, #process, #rewritten_code

Constructor Details

This class inherits a constructor from Synvert::Core::Rewriter::Action

Instance Method Details

#calculate_positionObject



8
9
10
11
# File 'lib/synvert/core/rewriter/action/append_action.rb', line 8

def calculate_position
  @begin_pos = :begin == @node.type ? @node.loc.expression.end_pos : @node.loc.expression.end_pos - @node.column - END_LENGTH
  @end_pos = @begin_pos
end