Class: ReVIEW::Book::ImageIndex
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Index
#[], #add_item, #each, #item_type, #key?, #number
Constructor Details
#initialize(chapid, basedir, types, builder) ⇒ ImageIndex
180
181
182
183
184
185
186
187
188
|
# File 'lib/review/book/index.rb', line 180
def initialize(chapid, basedir, types, builder)
super()
@chapid = chapid
@basedir = basedir
@types = types
@logger = ReVIEW.logger
@image_finder = ReVIEW::Book::ImageFinder.new(basedir, chapid, builder, types)
end
|
Instance Attribute Details
#image_finder ⇒ Object
Returns the value of attribute image_finder.
178
179
180
|
# File 'lib/review/book/index.rb', line 178
def image_finder
@image_finder
end
|
Class Method Details
.item_type ⇒ Object
174
175
176
|
# File 'lib/review/book/index.rb', line 174
def self.item_type
'(image|graph|imgtable)'
end
|
.parse(src, *args) ⇒ Object
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/review/book/index.rb', line 153
def self.parse(src, *args)
index = self.new(*args)
seq = 1
src.grep(%r{\A//#{item_type}}) do |line|
elements = line.split(/\[(.*?)\]/)
if elements[1].present?
if line.start_with?('//imgtable')
index.add_item(ReVIEW::Book::Index::Item.new(elements[1], 0, elements[3]))
else
index.add_item(ReVIEW::Book::Index::Item.new(elements[1], seq, elements[3]))
seq += 1
end
if elements[1] == ''
ReVIEW.logger.warn "warning: no ID of #{item_type} in #{line}"
end
end
end
index
end
|
Instance Method Details
#find_path(id) ⇒ Object
190
191
192
|
# File 'lib/review/book/index.rb', line 190
def find_path(id)
@image_finder.find_path(id)
end
|