class ReVIEW::Book::IconIndex

Public Class Methods

new(items, chapid, basedir, types, builder) click to toggle source
# File lib/review/book/index.rb, line 211
def initialize(items, chapid, basedir, types, builder)
  @items = items
  @index = {}
  items.each do |i|
    ## warn "warning: duplicate ID: #{i.id} (#{i})" unless @index[i.id].nil?
    @index[i.id] = i
  end
  items.each do |i|
    i.index = self
  end
  @chapid = chapid
  @basedir = basedir
  @types = types

  @image_finder = ImageFinder.new(basedir, chapid, builder, types)
end
parse(src, *args) click to toggle source
# File lib/review/book/index.rb, line 228
def IconIndex.parse(src, *args)
  items = []
  seq = 1
  src.grep(%r@<icon>!) do |line|
    line.gsub(/@<icon>\{(.+?)\}/) do |m|
      items.push item_class().new($1, seq)
      seq += 1
    end
  end
  new(items, *args)
end