class EverExp::Html::Heading

Public Class Methods

new() click to toggle source
# File lib/ever_exp/heading.rb, line 4
def initialize
  @h = Title.new '999', 'heading'
end

Public Instance Methods

add(level, title) click to toggle source
# File lib/ever_exp/heading.rb, line 8
def add level, title
  subtitle = Title.new level, title
  last_st = h.last_subtitle
  title = h
  while true do
    if last_st.nil? or last_st.level == subtitle.level
      title.add_sub subtitle
      return
    end
    title = last_st
    last_st = last_st.last_subtitle
  end
end
to_h() click to toggle source
# File lib/ever_exp/heading.rb, line 22
def to_h
  h.subtitles.map(&:to_h)
end

Private Instance Methods

h() click to toggle source
# File lib/ever_exp/heading.rb, line 59
def h
  @h
end