248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
# File 'lib/metrocot.rb', line 248
def with_scanned_match_data( match_map, match_data )
scanner = if name
@node_scraper.scanner_by_name(name)
else
default_scanner
end
if scanner
match_map[name] = scanner.scan(match_data)
elsif name
match_map[name] = match_data
elsif self.is_a?(CompositePattern) && match_data.is_a?(Hash)
log("copying #{match_data.class.name} match data from #{self.description}")
match_data.each { |key, value|
match_map[key] = value
}
else
log("not carrying #{match_data.class.name} match data from #{self.description}")
end
result = yield( match_map )
match_map.delete(name) if name
return result
end
|