Sha256: 15694570f208965434eb76bf224675b7cf02dc270189a725ac3e2d16b15e0cfd
Contents?: true
Size: 634 Bytes
Versions: 14
Compression:
Stored size: 634 Bytes
Contents
# frozen_string_literal: true module Synvert::Core # ReplaceAction to replace child node with code. class Rewriter::ReplaceAction < Rewriter::Action def initialize(instance, *selectors, with:) super(instance, with) @selectors = selectors end def calculate_position @begin_pos = @selectors.map { |selector| @node.child_node_range(selector).begin_pos }.min @end_pos = @selectors.map { |selector| @node.child_node_range(selector).end_pos }.max end # The rewritten source code. # # @return [String] rewritten code. def rewritten_code rewritten_source end end end
Version data entries
14 entries across 14 versions & 1 rubygems