Sha256: 75774b6015196ec72dc3c1a2313f9dcdbde2fb1c0fa56a1d91de2b19358698be
Contents?: true
Size: 675 Bytes
Versions: 5
Compression:
Stored size: 675 Bytes
Contents
module ATP module Processors # Appends the given node to the node with the given ID, if it exists # somewhere within the given parent node class AppendTo < Processor def run(parent, node, id, options = {}) @to_be_appended = node @id_of_to_be_appended_to = id @found = false process(parent) end def succeeded? @found end def handler_missing(node) if node.id == @id_of_to_be_appended_to @found = true node.updated(nil, node.children + [@to_be_appended]) else node.updated(nil, process_all(node.children)) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems