# File lib/review/book/index.rb, line 203 def initialize(items, chapid, basedir, types, builder) @items = items @index = {} items.each { |i| @index[i.id] = i } items.each { |i| i.index = self } @chapid = chapid @basedir = basedir @types = types @image_finder = ImageFinder.new(basedir, chapid, builder, types) end
# File lib/review/book/index.rb, line 215 def self.parse(src, *args) items = [] seq = 1 src.grep(/@<icon>/) do |line| line.gsub(/@<icon>\{(.+?)\}/) do items.push item_class.new($1, seq) seq += 1 end end new(items, *args) end