class Async::Node
def consume
If the node has a parent, and is {finished?}, then remove this node from
def consume if parent = @parent and finished? parent.remove_child(self) # If we have children, then we need to move them to our the parent if they are not finished: if @children while child = @children.shift if child.finished? child.set_parent(nil) else parent.add_child(child) end end @children = nil end parent.consume end end