summaryrefslogtreecommitdiff
path: root/lib/rdoc/normal_class.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 04:28:14 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 04:28:14 +0000
commit1c279a7d2753949c725754e1302f791b76358114 (patch)
tree36aa3bdde250e564445eba5f2e25fcb96bcb6cef /lib/rdoc/normal_class.rb
parentc72f0daa877808e4fa5018b3191ca09d4b97c03d (diff)
* lib/rdoc*: Updated to RDoc 4.0 (pre-release)
* bin/rdoc: ditto * test/rdoc: ditto * NEWS: Updated with RDoc 4.0 information git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/normal_class.rb')
-rw-r--r--lib/rdoc/normal_class.rb35
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/rdoc/normal_class.rb b/lib/rdoc/normal_class.rb
index f67380e783..dd7482c37c 100644
--- a/lib/rdoc/normal_class.rb
+++ b/lib/rdoc/normal_class.rb
@@ -1,15 +1,23 @@
-require 'rdoc/class_module'
-
##
# A normal class, neither singleton nor anonymous
class RDoc::NormalClass < RDoc::ClassModule
##
- # Appends the superclass, if any, to the included modules.
+ # The ancestors of this class including modules. Unlike Module#ancestors,
+ # this class is not included in the result. The result will contain both
+ # RDoc::ClassModules and Strings.
def ancestors
- superclass ? super + [superclass] : super
+ if String === superclass then
+ super << superclass
+ elsif superclass then
+ ancestors = super
+ ancestors << superclass
+ ancestors.concat superclass.ancestors
+ else
+ super
+ end
end
##
@@ -19,11 +27,15 @@ class RDoc::NormalClass < RDoc::ClassModule
"class #{full_name}"
end
+ def direct_ancestors
+ superclass ? super + [superclass] : super
+ end
+
def inspect # :nodoc:
superclass = @superclass ? " < #{@superclass}" : nil
- "<%s:0x%x class %s%s includes: %p attributes: %p methods: %p aliases: %p>" % [
+ "<%s:0x%x class %s%s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
self.class, object_id,
- full_name, superclass, @includes, @attributes, @method_list, @aliases
+ full_name, superclass, @includes, @extends, @attributes, @method_list, @aliases
]
end
@@ -46,19 +58,24 @@ class RDoc::NormalClass < RDoc::ClassModule
q.seplist @includes do |inc| q.pp inc end
q.breakable
+ q.text "constants:"
+ q.breakable
+ q.seplist @constants do |const| q.pp const end
+
+ q.breakable
q.text "attributes:"
q.breakable
- q.seplist @attributes do |inc| q.pp inc end
+ q.seplist @attributes do |attr| q.pp attr end
q.breakable
q.text "methods:"
q.breakable
- q.seplist @method_list do |inc| q.pp inc end
+ q.seplist @method_list do |meth| q.pp meth end
q.breakable
q.text "aliases:"
q.breakable
- q.seplist @aliases do |inc| q.pp inc end
+ q.seplist @aliases do |aliaz| q.pp aliaz end
q.breakable
q.text "comment:"