summaryrefslogtreecommitdiff
path: root/lib/rdoc/parsers/parse_rb.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-24 06:45:50 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-24 06:45:50 +0000
commit2ef0c6a1098cf9a237e49eff2542eeea8d0f8440 (patch)
tree86b1f80309a62d1dedb7ab8c839307b886c9ec9a /lib/rdoc/parsers/parse_rb.rb
parent83b531e3eaeb4ab435c94634ad50b51600c35e53 (diff)
* document updates - [ruby-core:04296], [ruby-core:04301],
[ruby-core:04302], [ruby-core:04307] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parsers/parse_rb.rb')
-rw-r--r--lib/rdoc/parsers/parse_rb.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/rdoc/parsers/parse_rb.rb b/lib/rdoc/parsers/parse_rb.rb
index e306598dee..fd95b2b7c8 100644
--- a/lib/rdoc/parsers/parse_rb.rb
+++ b/lib/rdoc/parsers/parse_rb.rb
@@ -1883,6 +1883,7 @@ module RDoc
name_t = get_tk
back_tk = skip_tkspace
meth = nil
+ added_container = false
dot = get_tk
if dot.kind_of?(TkDOT) or dot.kind_of?(TkCOLON2)
@@ -1897,8 +1898,21 @@ module RDoc
prev_container = container
container = container.find_module_named(name_t.name)
if !container
- warn("Couldn't find #{name_t.name}. Assuming it's a module")
- container = prev_container.add_module(NormalModule, name_t.name)
+ added_container = true
+ obj = name_t.name.split("::").inject(Object) do |state, item|
+ state.const_get(item)
+ end rescue nil
+
+ type = obj.class == Class ? NormalClass : NormalModule
+ if not [Class, Module].include?(obj.class)
+ warn("Couldn't find #{name_t.name}. Assuming it's a module")
+ end
+
+ if type == NormalClass then
+ container = prev_container.add_class(type, name_t.name, obj.superclass.name)
+ else
+ container = prev_container.add_module(type, name_t.name)
+ end
end
else
# warn("Unexpected token '#{name_t2.inspect}'")
@@ -1940,7 +1954,9 @@ module RDoc
parse_method_parameters(meth)
if meth.document_self
- container.add_method(meth)
+ container.add_method(meth)
+ elsif added_container
+ container.document_self = false
end
# Having now read the method parameters and documentation modifiers, we