Method: RDoc::RI::Driver#class_cache

Defined in:
lib/rdoc/ri/driver.rb

#class_cacheObject



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/rdoc/ri/driver.rb', line 224

def class_cache
  return @class_cache if @class_cache

  newest = map_dirs('created.rid', :all) do |f|
    File.mtime f if test ?f, f
  end.max

  up_to_date = (File.exist?(class_cache_file_path) and
                newest and newest < File.mtime(class_cache_file_path))

  @class_cache = if up_to_date then
                   load_cache_for @class_cache_name
                 else
                   class_cache = {}

                   classes = map_dirs('**/cdesc*.yaml', :sys) { |f| Dir[f] }
                   populate_class_cache class_cache, classes

                   classes = map_dirs('**/cdesc*.yaml') { |f| Dir[f] }
                   warn "Updating class cache with #{classes.size} classes..."

                   populate_class_cache class_cache, classes, true
                   write_cache class_cache, class_cache_file_path
                 end
end