class ReVIEW::Book::HeadlineIndex

Constants

HEADLINE_PATTERN

Public Class Methods

new(chapter) click to toggle source
Calls superclass method ReVIEW::Book::Index::new
# File lib/review/book/index.rb, line 178
def initialize(chapter)
  super()
  @chapter = chapter
end

Public Instance Methods

number(id) click to toggle source
# File lib/review/book/index.rb, line 183
def number(id)
  unless self[id].number
    # when notoc
    return ''
  end

  n = @chapter.number
  # XXX: remove magic number (move to lib/review/book/chapter.rb)
  if @chapter.on_appendix? && @chapter.number > 0 && @chapter.number < 28
    n = @chapter.format_number(false)
  end
  ([n] + self[id].number).join('.')
end