lib/mdl/doc.rb
##
# Adds a 'level' and 'parent' option to all elements to show how nested they
# are
Adds a 'level' and 'parent' option to all elements to show how nested they
are
Adds a ' level ' and ' parent ' option to all elements to show how nested they are
def add_annotations(elements, level = 1, parent = nil)
      elements.each do |e|
        e.options[:element_level] = level
        e.options[:parent] = parent
        add_annotations(e.children, level + 1, e)
      end
    end
def add_annotations ( elements , level = 1 , parent = nil ) elements . each do | e | e . options [ :element_level ] = level e . options [ :parent ] = parent add_annotations ( e . children , level + 1 , e ) end end
Adds a 'level' and 'parent' option to all elements to show how nested they
are
Adds a ' level ' and ' parent ' option to all elements to show how nested they are
elements
<not_specific>
level
<not_specific>
parent
<not_specific>