From b7528b5edb1f9148ea00ebb6151720e5943b3f0b Mon Sep 17 00:00:00 2001 From: drbrain Date: Thu, 16 Jun 2011 04:59:24 +0000 Subject: * lib/rdoc.rb: Import RDoc 3.7 release candidate git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/top_level.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lib/rdoc/top_level.rb') 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 @@ -219,6 +219,20 @@ class RDoc::TopLevel < RDoc::Context end 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. # @@ -295,6 +309,15 @@ class RDoc::TopLevel < RDoc::Context RDoc::TopLevel.files_hash[file_name] = self 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+. @@ -375,6 +398,14 @@ class RDoc::TopLevel < RDoc::Context @relative_name 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+ -- cgit v1.2.3