Module: Thaum::Tree

Defined in:
lib/thaum/tree.rb

Overview

Recursive walk over a Layout subtree. Yields every direct or transitive child of ‘node`, in declaration order. Callers filter by class.

Class Method Summary collapse

Class Method Details

.walk(node, &block) ⇒ Object



9
10
11
12
13
14
# File 'lib/thaum/tree.rb', line 9

def walk(node, &block)
  (node.subtree_children || []).each do |child|
    block.call(child)
    walk(child, &block) if child.respond_to?(:subtree_children)
  end
end