Method: ActiveComponent::Base#each_leaf

Defined in:
lib/active_component/base.rb

#each_leaf {|node| ... } ⇒ Object

Yields every leaf node of the (sub)tree rooted at the receiver node to the specified block.

May yield this node as well if this is a leaf node. Leaf traversal is depth-first and left-to-right.

Yields:

  • (node)

    Each leaf node is passed to the block.

Yield Parameters:

  • node (Tree::TreeNode)

    Each leaf node.

See Also:



502
503
504
# File 'lib/active_component/base.rb', line 502

def each_leaf &block
  self.each { |node| yield(node) if node.isLeaf? }
end