method
class_cache

v1_9_1_378 -
Show latest stable
-
0 notes -
Class: Driver
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (38)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
class_cache()
public
Hide source
# File lib/rdoc/ri/driver.rb, line 332 def class_cache return @class_cache if @class_cache # Get the documentation directories used to make the cache in order to see # whether the cache is valid for the current ri instantiation. if(File.readable?(@cache_doc_dirs_path)) cache_doc_dirs = IO.read(@cache_doc_dirs_path).split("\n") else cache_doc_dirs = [] end newest = map_dirs('created.rid') do |f| File.mtime f if test ff, f end.max # An up to date cache file must have been created more recently than # the last modification of any of the documentation directories. It also # must have been created with the same documentation directories # as those from which ri currently is sourcing documentation. up_to_date = (File.exist?(class_cache_file_path) and newest and newest < File.mtime(class_cache_file_path) and (cache_doc_dirs == @doc_dirs)) if up_to_date and @use_cache then open class_cache_file_path, 'rb' do |fp| begin @class_cache = Marshal.load fp.read rescue # # This shouldn't be necessary, since the up_to_date logic above # should force the cache to be recreated when a new version of # rdoc is installed. This seems like a worthwhile enhancement # to ri's robustness, however. # $stderr.puts "Error reading the class cache; recreating the class cache!" @class_cache = create_class_cache end end else @class_cache = create_class_cache end @class_cache end