Class: Synvert::Core::Rewriter::AddAction

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

Overview

AddAction to add code to the node.

Constant Summary

Constants inherited from Action

Synvert::Core::Rewriter::Action::DEFAULT_INDENT, Synvert::Core::Rewriter::Action::DEFAULT_OPTIONS

Instance Method Summary collapse

Methods inherited from Action

#initialize, #line, #rewritten_source

Constructor Details

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

Instance Method Details

#begin_posInteger

Begin position to insert code.

Returns:

  • (Integer)

    begin position.



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

def begin_pos
  @node.loc.expression.end_pos
end

#end_posInteger

End position, always same to begin position.

Returns:

  • (Integer)

    end position.



16
17
18
# File 'lib/synvert/core/rewriter/action/add_action.rb', line 16

def end_pos
  begin_pos
end