Sha256: 7dd25f145f78c5de4e5ac6f3b5da412417b16ad00aa703c396160d25ed3ef5aa
Contents?: true
Size: 781 Bytes
Versions: 7
Compression:
Stored size: 781 Bytes
Contents
# frozen_string_literal: true module Synvert::Core # ReplaceAction to replace child node with code. class Rewriter::ReplaceAction < Rewriter::Action def initialize(instance, selector, with:) @instance = instance @selector = selector @code = with @node = @instance.current_node end # Begin position of code to replace. # # @return [Integer] begin position. def begin_pos @node.child_node_range(@selector).begin_pos end # End position of code to replace. # # @return [Integer] end position. def end_pos @node.child_node_range(@selector).end_pos end # The rewritten source code. # # @return [String] rewritten code. def rewritten_code rewritten_source end end end
Version data entries
7 entries across 7 versions & 1 rubygems