Method: MaRuKu::MDElement#replace_each_string
- Defined in:
- lib/maruku/element.rb
#replace_each_string(&block) ⇒ Object
TODO:
Make this non-destructive
Iterates through each String child node of this element, replacing it with the result of the block. This includes deeply-nested child nodes.
This destructively modifies this node and its children.
113 114 115 116 117 118 119 |
# File 'lib/maruku/element.rb', line 113 def replace_each_string(&block) @children.map! do |c| next yield c unless c.is_a?(MDElement) c.replace_each_string(&block) c end.flatten! end |