Method: Commonmarker::Node#walk

Defined in:
lib/commonmarker/node.rb

#walk {|_self| ... } ⇒ Object

Public: An iterator that “walks the tree,” descending into children recursively.

blk - A Proc representing the action to take for each child

Yields:

  • (_self)

Yield Parameters:



14
15
16
17
18
19
20
21
# File 'lib/commonmarker/node.rb', line 14

def walk(&block)
  return enum_for(:walk) unless block

  yield self
  each do |child|
    child.walk(&block)
  end
end