Class: ReVIEW::Book::IconIndex

Inherits:
ImageIndex show all
Defined in:
lib/review/book/index.rb

Instance Attribute Summary

Attributes inherited from ImageIndex

#image_finder

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ImageIndex

#find_path, item_type

Methods inherited from Index

#[], #add_item, #each, #item_type, #key?, #number

Constructor Details

#initialize(chapid, basedir, types, builder) ⇒ IconIndex

Returns a new instance of IconIndex.



196
197
198
199
200
201
202
203
204
# File 'lib/review/book/index.rb', line 196

def initialize(chapid, basedir, types, builder)
  @index = {}
  @chapid = chapid
  @basedir = basedir
  @types = types
  @logger = ReVIEW.logger

  @image_finder = ImageFinder.new(basedir, chapid, builder, types)
end

Class Method Details

.parse(src, *args) ⇒ Object



206
207
208
209
210
211
212
213
214
215
216
# File 'lib/review/book/index.rb', line 206

def self.parse(src, *args)
  index = self.new(*args)
  seq = 1
  src.grep(/@<icon>/) do |line|
    line.gsub(/@<icon>\{(.+?)\}/) do
      index.add_item(ReVIEW::Book::Index::Item.new($1, seq))
      seq += 1
    end
  end
  index
end