267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
# File 'lib/rdoc/ri/driver.rb', line 267
def load_cache_for(klassname)
path = cache_file_for klassname
if File.exist? path and
File.mtime(path) >= File.mtime(class_cache_file_path) then
File.open path, 'rb' do |fp|
Marshal.load fp.read
end
else
class_cache = nil
File.open class_cache_file_path, 'rb' do |fp|
class_cache = Marshal.load fp.read
end
klass = class_cache[klassname]
return nil unless klass
method_files = klass["sources"]
cache = {}
sys_dir = @sys_dirs.first
method_files.each do |f|
system_file = f.index(sys_dir) == 0
Dir[File.join(File.dirname(f), "*")].each do |yaml|
next unless yaml =~ /yaml$/
next if yaml =~ /cdesc-[^\/]+yaml$/
method = read_yaml yaml
name = method["full_name"]
ext_path = f
ext_path = "gem #{$1}" if f =~ %r%gems/[\d.]+/doc/([^/]+)%
method["source_path"] = ext_path unless system_file
cache[name] = method
end
end
write_cache cache, path
end
end
|