class Synvert::Core::Rewriter::AppendAction
AppendAction
to append code to the bottom of node body.
Constants
- END_LENGTH
Public Instance Methods
begin_pos()
click to toggle source
Begin position to append code.
@return [Integer] begin position.
# File lib/synvert/core/rewriter/action/append_action.rb, line 11 def begin_pos if :begin == @node.type @node.loc.expression.end_pos else @node.loc.expression.end_pos - @node.column - END_LENGTH end end
end_pos()
click to toggle source
End position, always same to begin position.
@return [Integer] end position.
# File lib/synvert/core/rewriter/action/append_action.rb, line 22 def end_pos begin_pos end
Private Instance Methods
indent(node)
click to toggle source
Indent of the node.
@param node [Parser::AST::Node] @return [String] n times whitesphace
# File lib/synvert/core/rewriter/action/append_action.rb, line 32 def indent(node) if %i[block class].include? node.type ' ' * (node.column + DEFAULT_INDENT) else ' ' * node.column end end