summaryrefslogtreecommitdiff
path: root/lib/rdoc/store.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/store.rb')
-rw-r--r--lib/rdoc/store.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb
index b7e677abf9..f420fc2bd2 100644
--- a/lib/rdoc/store.rb
+++ b/lib/rdoc/store.rb
@@ -148,6 +148,7 @@ class RDoc::Store
@classes_hash = {}
@modules_hash = {}
@files_hash = {}
+ @text_files_hash = {}
@c_enclosure_classes = {}
@c_enclosure_names = {}
@@ -184,16 +185,24 @@ class RDoc::Store
# Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the
# created RDoc::TopLevel.
- def add_file absolute_name, relative_name = absolute_name
+ def add_file absolute_name, relative_name: absolute_name, parser: nil
unless top_level = @files_hash[relative_name] then
top_level = RDoc::TopLevel.new absolute_name, relative_name
+ top_level.parser = parser if parser
top_level.store = self
@files_hash[relative_name] = top_level
+ @text_files_hash[relative_name] = top_level if top_level.text?
end
top_level
end
+ def update_parser_of_file(absolute_name, parser)
+ if top_level = @files_hash[absolute_name] then
+ @text_files_hash[absolute_name] = top_level if top_level.text?
+ end
+ end
+
##
# Returns all classes discovered by RDoc
@@ -428,8 +437,8 @@ class RDoc::Store
# +file_name+
def find_text_page file_name
- @files_hash.each_value.find do |file|
- file.text? and file.full_name == file_name
+ @text_files_hash.each_value.find do |file|
+ file.full_name == file_name
end
end
@@ -537,6 +546,7 @@ class RDoc::Store
@cache[:pages].each do |page_name|
page = load_page page_name
@files_hash[page_name] = page
+ @text_files_hash[page_name] = page if page.text?
end
end
@@ -712,8 +722,8 @@ class RDoc::Store
# Returns the RDoc::TopLevel that is a text file and has the given +name+
def page name
- @files_hash.each_value.find do |file|
- file.text? and file.page_name == name
+ @text_files_hash.each_value.find do |file|
+ file.page_name == name
end
end