class Infoboxer::Navigation::Sections::Section

Virtual node, representing logical section of the document. Is not, in fact, in the tree.

See {Sections parent module} documentation for details.

Attributes

heading[R]

Section's heading.

@return {Tree::Heading}

Public Class Methods

new(heading, children = Tree::Nodes[]) click to toggle source
# File lib/infoboxer/navigation/sections.rb, line 189
def initialize(heading, children = Tree::Nodes[])
  # no super: we don't wont to rewrite children's parent
  @children = Tree::Nodes[*children]
  @heading = heading
  @params = {level: heading.level, heading: heading.text.strip}
end

Public Instance Methods

empty?() click to toggle source
# File lib/infoboxer/navigation/sections.rb, line 208
def empty?
  false
end
inspect() click to toggle source
# File lib/infoboxer/navigation/sections.rb, line 212
def inspect
  "#<#{descr}: #{children.count} nodes>"
end
push_children(*nodes) click to toggle source

no rewriting of parent, again

# File lib/infoboxer/navigation/sections.rb, line 202
def push_children(*nodes)
  nodes.each do |n|
    @children << n
  end
end