class EverExp::Html::Heading::Title

Attributes

level[R]
parent_title[RW]
subtitles[R]
title[R]

Public Class Methods

new(lvl, ti) click to toggle source
# File lib/ever_exp/heading.rb, line 31
def initialize lvl, ti
  @level = lvl
  @title = ti
  @subtitles = []
end

Public Instance Methods

add_sib(node) click to toggle source
# File lib/ever_exp/heading.rb, line 46
def add_sib node
  parent_title.add_sub node
end
add_sub(node) click to toggle source
# File lib/ever_exp/heading.rb, line 41
def add_sub node
  node.parent_title = self
  subtitles << node
end
last_subtitle() click to toggle source
# File lib/ever_exp/heading.rb, line 37
def last_subtitle
  subtitles.last
end
to_h() click to toggle source
# File lib/ever_exp/heading.rb, line 50
def to_h
  return title if subtitles.empty?
  {title => subtitles.map(&:to_h)}
end