Method: Async::Node#consume
- Defined in:
- lib/async/node.rb
#consume ⇒ Object
If the node has a parent, and is #finished?, then remove this node from the parent.
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/async/node.rb', line 231 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 |