Class: RDoc::NormalClass

Inherits:
ClassModule show all
Defined in:
lib/rdoc/normal_class.rb

Overview

A normal class, neither singleton nor anonymous

Constant Summary

Constants inherited from ClassModule

ClassModule::MARSHAL_VERSION

Constants inherited from Context

Context::TOMDOC_TITLES, Context::TOMDOC_TITLES_SORT, Context::TYPES

Constants included from Text

Text::MARKUP_FORMAT, Text::TO_HTML_CHARACTERS

Instance Attribute Summary

Attributes inherited from ClassModule

#comment_location, #constant_aliases, #diagram, #is_alias_for

Attributes inherited from Context

#aliases, #attributes, #block_params, #constants, #constants_hash, #current_section, #extends, #external_aliases, #in_files, #includes, #method_list, #methods_hash, #name, #params, #requires, #temporary_section, #unmatched_alias_lists, #visibility

Attributes inherited from CodeObject

#comment, #document_children, #document_self, #done_documenting, #file, #force_documentation, #line, #metadata, #offset, #parent, #received_nodoc, #section, #store, #viewer

Instance Method Summary collapse

Methods inherited from ClassModule

#add_comment, #add_things, #aref, #clear_comment, #comment=, #complete, #description, #document_self_or_methods, #documented?, #each_ancestor, #find_ancestor_local_symbol, #find_class_named, from_module, #full_name, #initialize, #marshal_dump, #marshal_load, #merge, #merge_collections, #merge_sections, #module?, #name=, #name_for_path, #non_aliases, #parse, #path, #remove_nodoc_children, #remove_things, #search_record, #store=, #superclass, #superclass=, #type, #update_aliases, #update_extends, #update_includes

Methods inherited from Context

#<=>, #add, #add_alias, #add_attribute, #add_class, #add_class_or_module, #add_constant, #add_extend, #add_include, #add_method, #add_module, #add_module_alias, #add_require, #add_section, #add_to, #any_content, #child_name, #class_attributes, #class_method_list, #classes, #classes_and_modules, #classes_hash, #defined_in?, #display, #each_ancestor, #each_attribute, #each_classmodule, #each_constant, #each_extend, #each_include, #each_method, #each_section, #find_attribute, #find_attribute_named, #find_class_method_named, #find_constant_named, #find_enclosing_module_named, #find_external_alias, #find_external_alias_named, #find_file_named, #find_instance_method_named, #find_local_symbol, #find_method, #find_method_named, #find_module_named, #find_symbol, #find_symbol_module, #full_name, #fully_documented?, #http_url, #initialize, #initialize_methods_etc, #instance_attributes, #instance_method_list, #methods_by_type, #methods_matching, #modules, #modules_hash, #name_for_path, #ongoing_visibility=, #record_location, #remove_from_documentation?, #remove_invisible, #remove_invisible_in, #resolve_aliases, #section_contents, #sections, #sections_hash, #set_current_section, #set_visibility_for, #sort_sections, #top_level, #upgrade_to_class

Methods inherited from CodeObject

#display?, #documented?, #each_parent, #file_name, #full_name=, #ignore, #ignored?, #initialize, #initialize_visibility, #options, #parent_file_name, #parent_name, #record_location, #start_doc, #stop_doc, #suppress, #suppressed?

Methods included from Generator::Markup

#aref_to, #as_href, #cvs_url, #description, #formatter

Methods included from Text

encode_fallback, #expand_tabs, #flush_left, #markup, #normalize_comment, #parse, #snippet, #strip_hashes, #strip_newlines, #strip_stars, #to_html, #wrap

Constructor Details

This class inherits a constructor from RDoc::ClassModule

Instance Method Details

#ancestorsObject

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.


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rdoc/normal_class.rb', line 11

def ancestors
  if String === superclass then
    super << superclass
  elsif superclass then
    ancestors = super
    ancestors << superclass
    ancestors.concat superclass.ancestors
  else
    super
  end
end

#aref_prefixObject

:nodoc:


23
24
25
# File 'lib/rdoc/normal_class.rb', line 23

def aref_prefix # :nodoc:
  'class'
end

#definitionObject

The definition of this class, class MyClassName


30
31
32
# File 'lib/rdoc/normal_class.rb', line 30

def definition
  "class #{full_name}"
end

#direct_ancestorsObject


34
35
36
# File 'lib/rdoc/normal_class.rb', line 34

def direct_ancestors
  superclass ? super + [superclass] : super
end

#inspectObject

:nodoc:


38
39
40
41
42
43
44
# File 'lib/rdoc/normal_class.rb', line 38

def inspect # :nodoc:
  superclass = @superclass ? " < #{@superclass}" : nil
  "<%s:0x%x class %s%s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
    self.class, object_id,
    full_name, superclass, @includes, @extends, @attributes, @method_list, @aliases
  ]
end

#pretty_print(q) ⇒ Object

:nodoc:


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/rdoc/normal_class.rb', line 55

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

    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 |attr| q.pp attr end

    q.breakable
    q.text "methods:"
    q.breakable
    q.seplist @method_list do |meth| q.pp meth end

    q.breakable
    q.text "aliases:"
    q.breakable
    q.seplist @aliases do |aliaz| q.pp aliaz end

    q.breakable
    q.text "comment:"
    q.breakable
    q.pp comment
  end
end

#to_sObject

:nodoc:


46
47
48
49
50
51
52
53
# File 'lib/rdoc/normal_class.rb', line 46

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