class ReVIEW::Book::ColumnIndex

Constants

COLUMN_PATTERN
Item

Public Class Methods

parse(src, *args) click to toggle source
# File lib/review/book/index.rb, line 356
def ColumnIndex.parse(src, *args)
  items = []
  seq = 1
  src.each do |line|
    if m = COLUMN_PATTERN.match(line)
      _level = m[1] ## not use it yet
      id = m[2]
      caption = m[3].strip
      if !id || id == ""
        id = caption
      end

      items.push item_class().new(id, seq, caption)
      seq += 1
    end
  end
  new(items)
end