2010-04-01 03:45:16 -04:00
|
|
|
##
|
|
|
|
# A normal class, neither singleton nor anonymous
|
|
|
|
|
|
|
|
class RDoc::NormalClass < RDoc::ClassModule
|
|
|
|
|
|
|
|
##
|
2012-11-26 23:28:14 -05:00
|
|
|
# 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.
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
def ancestors
|
2012-11-26 23:28:14 -05:00
|
|
|
if String === superclass then
|
|
|
|
super << superclass
|
|
|
|
elsif superclass then
|
|
|
|
ancestors = super
|
|
|
|
ancestors << superclass
|
|
|
|
ancestors.concat superclass.ancestors
|
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def aref_prefix # :nodoc:
|
|
|
|
'class'
|
|
|
|
end
|
|
|
|
|
2011-02-01 19:32:30 -05:00
|
|
|
##
|
|
|
|
# The definition of this class, <tt>class MyClassName</tt>
|
|
|
|
|
|
|
|
def definition
|
|
|
|
"class #{full_name}"
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def direct_ancestors
|
|
|
|
superclass ? super + [superclass] : super
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def inspect # :nodoc:
|
|
|
|
superclass = @superclass ? " < #{@superclass}" : nil
|
2012-11-26 23:28:14 -05:00
|
|
|
"<%s:0x%x class %s%s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
|
2010-04-01 03:45:16 -04:00
|
|
|
self.class, object_id,
|
2012-11-26 23:28:14 -05:00
|
|
|
full_name, superclass, @includes, @extends, @attributes, @method_list, @aliases
|
2010-04-01 03:45:16 -04:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def to_s # :nodoc:
|
|
|
|
display = "#{self.class.name} #{self.full_name}"
|
|
|
|
if superclass
|
|
|
|
display << ' < ' << (superclass.is_a?(String) ? superclass : superclass.full_name)
|
|
|
|
end
|
|
|
|
display << ' -> ' << is_alias_for.to_s if is_alias_for
|
|
|
|
display
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def pretty_print q # :nodoc:
|
|
|
|
superclass = @superclass ? " < #{@superclass}" : nil
|
|
|
|
|
|
|
|
q.group 2, "[class #{full_name}#{superclass} ", "]" do
|
|
|
|
q.breakable
|
|
|
|
q.text "includes:"
|
|
|
|
q.breakable
|
|
|
|
q.seplist @includes do |inc| q.pp inc end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
q.breakable
|
|
|
|
q.text "constants:"
|
|
|
|
q.breakable
|
|
|
|
q.seplist @constants do |const| q.pp const end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
q.breakable
|
|
|
|
q.text "attributes:"
|
|
|
|
q.breakable
|
2012-11-26 23:28:14 -05:00
|
|
|
q.seplist @attributes do |attr| q.pp attr end
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text "methods:"
|
|
|
|
q.breakable
|
2012-11-26 23:28:14 -05:00
|
|
|
q.seplist @method_list do |meth| q.pp meth end
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text "aliases:"
|
|
|
|
q.breakable
|
2012-11-26 23:28:14 -05:00
|
|
|
q.seplist @aliases do |aliaz| q.pp aliaz end
|
2010-04-01 03:45:16 -04:00
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text "comment:"
|
|
|
|
q.breakable
|
|
|
|
q.pp comment
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|