Class: ReVIEW::Book::ColumnIndex
- Defined in:
- lib/review/book/index.rb
Defined Under Namespace
Classes: Item
Constant Summary collapse
- COLUMN_PATTERN =
/\A(=+)\[column\](?:\{(.+?)\})?(.*)/
Class Method Summary collapse
Methods inherited from Index
#[], #each, #has_key?, #initialize, item_class, #item_type, #number
Constructor Details
This class inherits a constructor from ReVIEW::Book::Index
Class Method Details
.parse(src, *args) ⇒ Object
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/review/book/index.rb', line 355 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 |