Sha256: 30c4c535fd085e4a85760b43e968e8ab2ce1644ae3733bfcac6c9486a1ef7a4c
Contents?: true
Size: 603 Bytes
Versions: 23
Compression:
Stored size: 603 Bytes
Contents
# frozen_string_literal: true # AppendAction appends code to the bottom of node body. class NodeMutation::AppendAction < NodeMutation::Action private END_LENGTH = "\nend".length # Calculate the begin the end positions. def calculate_position @start = NodeMutation.adapter.get_end(@node) - NodeMutation.adapter.get_start_loc(@node).column - END_LENGTH @end = @start end # Indent of the node. # # @param node [Parser::AST::Node] # @return [String] n times whitesphace def indent(node) ' ' * (NodeMutation.adapter.get_start_loc(node).column + DEFAULT_INDENT) end end
Version data entries
23 entries across 23 versions & 1 rubygems