Class: ReVIEW::Book::IconIndex
- Inherits:
-
ImageIndex
- Object
- Index
- ImageIndex
- ReVIEW::Book::IconIndex
- Defined in:
- lib/review/book/index.rb
Instance Attribute Summary
Attributes inherited from ImageIndex
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(items, chapid, basedir, types, builder) ⇒ IconIndex
constructor
A new instance of IconIndex.
Methods inherited from ImageIndex
Methods inherited from Index
#[], #each, #item_type, #key?, #number
Constructor Details
#initialize(items, chapid, basedir, types, builder) ⇒ IconIndex
Returns a new instance of IconIndex.
194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/review/book/index.rb', line 194 def initialize(items, chapid, basedir, types, builder) @items = items @index = {} items.each { |item| @index[item.id] = item } items.each { |item| item.index = self } @chapid = chapid @basedir = basedir @types = types @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) items = [] seq = 1 src.grep(/@<icon>/) do |line| line.gsub(/@<icon>\{(.+?)\}/) do items.push(ReVIEW::Book::Index::Item.new($1, seq)) seq += 1 end end new(items, *args) end |