class RDoc::RI::Driver

def display_class name

def display_class name
  return if name =~ /#|\./
  klasses = []
  includes = []
  found = @stores.map do |store|
    begin
      klass = store.load_class name
      klasses  << klass
      includes << [klass.includes, store] if klass.includes
      [store, klass]
    rescue Errno::ENOENT
    end
  end.compact
  return if found.empty?
  also_in = []
  includes.reject! do |modules,| modules.empty? end
  out = RDoc::Markup::Document.new
  add_class out, name, klasses
  add_includes out, includes
  found.each do |store, klass|
    comment = klass.comment
    class_methods    = store.class_methods[klass.full_name]
    instance_methods = store.instance_methods[klass.full_name]
    attributes       = store.attributes[klass.full_name]
    if comment.empty? and !(instance_methods or class_methods) then
      also_in << store
      next
    end
    add_from out, store
    unless comment.empty? then
      out << RDoc::Markup::Rule.new(1)
      out << comment
    end
    if class_methods or instance_methods or not klass.constants.empty? then
      out << RDoc::Markup::Rule.new
    end
    unless klass.constants.empty? then
      out << RDoc::Markup::Heading.new(1, "Constants:")
      out << RDoc::Markup::BlankLine.new
      list = RDoc::Markup::List.new :NOTE
      constants = klass.constants.sort_by { |constant| constant.name }
      list.push(*constants.map do |constant|
        parts = constant.comment.parts if constant.comment
        parts << RDoc::Markup::Paragraph.new('[not documented]') if
          parts.empty?
        RDoc::Markup::ListItem.new(constant.name, *parts)
      end)
      out << list
    end
    add_method_list out, class_methods,    'Class methods'
    add_method_list out, instance_methods, 'Instance methods'
    add_method_list out, attributes,       'Attributes'
    out << RDoc::Markup::BlankLine.new
  end
  add_also_in out, also_in
  display out
end