diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 03:22:49 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 03:22:49 +0000 |
commit | 2ef9c50c6e405717d06362787c4549ca4f1c6485 (patch) | |
tree | ee99486567461dd5796f3d6edcc9e204187f2666 /lib/rdoc/require.rb | |
parent | d7effd506f5b91a636f2e6452ef1946b923007c7 (diff) | |
download | ruby-2ef9c50c6e405717d06362787c4549ca4f1c6485.tar.gz |
Import RDoc 3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/require.rb')
-rw-r--r-- | lib/rdoc/require.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/rdoc/require.rb b/lib/rdoc/require.rb index 407b55af35..65d3d464da 100644 --- a/lib/rdoc/require.rb +++ b/lib/rdoc/require.rb @@ -16,6 +16,7 @@ class RDoc::Require < RDoc::CodeObject def initialize(name, comment) super() @name = name.gsub(/'|"/, "") #' + @top_level = nil self.comment = comment end @@ -28,5 +29,25 @@ class RDoc::Require < RDoc::CodeObject ] end + def to_s # :nodoc: + "require #{name} in: #{parent}" + end + + ## + # The RDoc::TopLevel corresponding to this require, or +nil+ if not found. + + def top_level + @top_level ||= begin + tl = RDoc::TopLevel.all_files_hash[name + '.rb'] + + if tl.nil? and RDoc::TopLevel.all_files.first.full_name =~ %r(^lib/) then + # second chance + tl = RDoc::TopLevel.all_files_hash['lib/' + name + '.rb'] + end + + tl + end + end + end |