class ReVIEW::TOCParser::Node

Attributes

children[R]

Public Class Methods

new(children = []) click to toggle source
# File lib/review/tocparser.rb, line 117
def initialize(children = [])
  @children = children
end

Public Instance Methods

add_child(c) click to toggle source
# File lib/review/tocparser.rb, line 123
def add_child(c)
  @children.push c
end
chapter?() click to toggle source
# File lib/review/tocparser.rb, line 138
def chapter?
  false
end
each_child(&block) click to toggle source
# File lib/review/tocparser.rb, line 134
def each_child(&block)
  @children.each(&block)
end
each_node() { |c| ... } click to toggle source
# File lib/review/tocparser.rb, line 127
def each_node(&block)
  @children.each do |c|
    yield c
    c.each(&block)
  end
end
each_section(&block) click to toggle source
# File lib/review/tocparser.rb, line 142
def each_section(&block)
  @children.each { |n| n.yield_section(&block) }
end
each_section_with_index() { |n, i| ... } click to toggle source
# File lib/review/tocparser.rb, line 146
def each_section_with_index
  i = 0
  each_section do |n|
    yield n, i
    i += 1
  end
end
section_size() click to toggle source
# File lib/review/tocparser.rb, line 154
def section_size
  cnt = 0
  @children.each { |n| n.yield_section { cnt += 1 } }
  cnt
end