diff options
-rw-r--r-- | lib/rdoc/store.rb | 127 |
1 files changed, 109 insertions, 18 deletions
@@ -69,7 +69,19 @@ class RDoc::Store # Stores the name of the C variable a class belongs to. This helps wire up # classes defined from C across files. - attr_reader :c_enclosure_classes ## # If true this Store will not write any files @@ -114,15 +126,17 @@ class RDoc::Store @type = type @cache = { - :ancestors => {}, - :attributes => {}, - :class_methods => {}, - :encoding => @encoding, - :instance_methods => {}, - :main => nil, - :modules => [], - :pages => [], - :title => nil, } @classes_hash = {} @@ -130,12 +144,35 @@ class RDoc::Store @files_hash = {} @c_enclosure_classes = {} @unique_classes = nil @unique_modules = nil end ## # Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the # created RDoc::TopLevel. @@ -305,6 +342,28 @@ class RDoc::Store end ## # Finds the class with +name+ in all discovered classes def find_class_named name @@ -500,22 +559,26 @@ class RDoc::Store @encoding = load_enc unless @encoding - @cache[:pages] ||= [] - @cache[:main] ||= nil @cache rescue Errno::ENOENT end ## - # Loads ri data for +klass_name+ def load_class klass_name - file = class_file klass_name - - obj = open file, 'rb' do |io| - Marshal.load io.read - end obj.store = self @@ -525,6 +588,17 @@ class RDoc::Store when RDoc::NormalModule then @modules_hash[klass_name] = obj end rescue Errno::ENOENT => e error = MissingFileError.new(self, file, klass_name) error.set_backtrace e.backtrace @@ -584,6 +658,20 @@ class RDoc::Store end ## # Path to the ri data for +method_name+ in +klass_name+ def method_file klass_name, method_name @@ -688,6 +776,9 @@ class RDoc::Store @cache[:encoding] = @encoding # this gets set twice due to assert_cache return if @dry_run marshal = Marshal.dump @cache |