diff options
Diffstat (limited to 'lib/rdoc/top_level.rb')
-rw-r--r-- | lib/rdoc/top_level.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb index d0ea621f8c..b9fd5c9f6f 100644 --- a/lib/rdoc/top_level.rb +++ b/lib/rdoc/top_level.rb @@ -220,6 +220,20 @@ class RDoc::TopLevel < RDoc::Context end ## + # Creates a new RDoc::TopLevel with +file_name+ only if one with the same + # name does not exist in all_files. + + def self.new file_name + if top_level = @all_files_hash[file_name] then + top_level + else + top_level = super + @all_files_hash[file_name] = top_level + top_level + end + end + + ## # Removes from +all_hash+ the contexts that are nodoc or have no content. # # See RDoc::Context#remove_from_documentation? @@ -296,6 +310,15 @@ class RDoc::TopLevel < RDoc::Context end ## + # An RDoc::TopLevel is equal to another with the same absolute_name + + def == other + other.class === self and @absolute_name == other.absolute_name + end + + alias eql? == + + ## # Adds +an_alias+ to +Object+ instead of +self+. def add_alias(an_alias) @@ -376,6 +399,14 @@ class RDoc::TopLevel < RDoc::Context end ## + # An RDoc::TopLevel has the same hash as another with the same + # absolute_name + + def hash + @absolute_name.hash + end + + ## # URL for this with a +prefix+ def http_url(prefix) |