123456789_123456789_123456789_123456789_123456789_

Class: RDoc::NormalModule

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: RDoc::ClassModule
Defined in: lib/rdoc/normal_module.rb

Overview

A normal module, like NormalClass

Constant Summary

Text - Included

MARKUP_FORMAT, TO_HTML_CHARACTERS

Context - Inherited

TOMDOC_TITLES, TOMDOC_TITLES_SORT, TYPES

ClassModule - Inherited

MARSHAL_VERSION

Class Method Summary

ClassModule - Inherited

.from_module

Return a ClassModule of class class_type that is a copy of module module.

.new

Creates a new ClassModule with name with optional #superclass

Context - Inherited

.new

Creates an unnamed empty context with public current visibility.

CodeObject - Inherited

.new

Creates a new CodeObject that will document itself and its children.

Instance Attribute Summary

ClassModule - Inherited

#comment_location

Comment and the location it came from.

#constant_aliases

Constants that are aliases for this class or module.

#documented?

Does this class or module have a comment with content or is #received_nodoc true?

#is_alias_for

Class or module this constant is an alias for.

#module?

Does this object represent a module?

#name=

Allows overriding the initial name.

#store=

Sets the store for this class or module and its contained code objects.

#superclass

Get the superclass of this class.

#superclass=

Set the superclass of this class to #superclass

#comment=

This method is deprecated, use #add_comment instead.

#diagram

Context - Inherited

#aliases

Class/module aliases.

#attributes

All attr* methods.

#block_params

Block params to be used in the next MethodAttr parsed under this context.

#constants

Constants defined.

#constants_hash

Hash of registered constants.

#current_line_visibility=

Current visibility of this line.

#current_section

The current documentation section that new items will be added to.

#current_section=

Sets the current documentation section of documentation.

#extends

Modules this context is extended with.

#external_aliases

Aliases that could not be resolved.

#fully_documented?

Does this context and its methods and constants all have documentation?

#in_files

Files this context is found in.

#includes

Modules this context includes.

#method_list

Methods defined in this context.

#methods_hash

Hash of registered methods.

#name

Name of this class excluding namespace.

#ongoing_visibility=

Changes the visibility for new methods to visibility

#params

Params to be used in the next MethodAttr parsed under this context.

#remove_from_documentation?

Should we remove this context from the documentation?

#requires

Files this context requires.

#temporary_section

Use this section for the next method, attribute or constant added.

#unmatched_alias_lists

Hash old_name => [aliases], for aliases that haven’t (yet) been resolved to a method/attribute.

#visibility

Current visibility of this context.

CodeObject - Inherited

#comment

Our comment.

#comment=

Replaces our comment with comment, unless it is empty.

#display?

Should this CodeObject be displayed in output?

#document_children

Do we document our children?

#document_children=

Enables or disables documentation of this CodeObject’s children unless it has been turned off by :enddoc:

#document_self

Do we document ourselves?

#document_self=

Enables or disables documentation of this CodeObject unless it has been turned off by :enddoc:.

#documented?

Does this object have a comment with content or is #received_nodoc true?

#done_documenting

Are we done documenting (ie, did we come across a :enddoc:)?

#done_documenting=

Turns documentation on/off, and turns on/off #document_self and #document_children.

#file

Which file this code object was defined in.

#force_documentation

Force documentation of this CodeObject.

#force_documentation=

Force the documentation of this object unless documentation has been turned off by :enddoc:

#full_name=

Sets the full_name overriding any computed full name.

#ignored?

Has this class been ignored?

#line

Line in #file where this CodeObject was defined.

#metadata

Hash of arbitrary metadata for this CodeObject.

#parent

Our parent CodeObject.

#parent=

Sets the parent CodeObject.

#received_nodoc

Did we ever receive a :nodoc: directive?

#section

The section this CodeObject is in.

#section=

Set the section this CodeObject is in.

#store

The Store for this object.

#store=

Sets the store that contains this CodeObject.

#suppressed?

Has this class been suppressed?

#viewer

We are the model of the code, but we know that at some point we will be worked on by viewers.

Instance Method Summary

ClassModule - Inherited

#add_comment

Adds comment to this ClassModule’s list of comments at location.

#ancestors

Ancestors list for this ClassModule: the list of included modules (classes will add their superclass if any).

#aref

HTML fragment reference for this module or class.

#clear_comment

Clears the comment.

#complete

Prepares this ClassModule for use by a generator.

#description

Handy wrapper for marking up this class or module’s comment.

#direct_ancestors

Ancestors of this class or module only.

#document_self_or_methods

Does this ClassModule or any of its methods have document_self set?

#each_ancestor

Iterates the ancestors of this class or module for which an ClassModule exists.

#find_ancestor_local_symbol

Looks for a symbol in the #ancestors.

#find_class_named

Finds a class or module with name in this namespace or its descendants.

#full_name

Return the fully qualified name of this class or module.

#merge

Merges class_module into this ClassModule.

#name_for_path

Name to use to generate the url: modules and classes that are aliases for another module or class return the name of the latter.

#non_aliases

Returns the classes and modules that are not constants aliasing another class or module.

#parse

Parses comment_location into an Markup::Document composed of multiple RDoc::Markup::Documents with their file set.

#path

Path to this class or module for use with HTML generator output.

#remove_nodoc_children

Updates the child modules or classes of class/module parent by deleting the ones that have been removed from the documentation.

#search_record

Search record used by Generator::JsonIndex

#type

‘module’ or ‘class’.

#update_aliases

Updates the child modules & classes by replacing the ones that are aliases through a constant.

#update_extends

Deletes from #extends those whose module has been removed from the documentation.

#update_includes

Deletes from #includes those whose module has been removed from the documentation.

#add_things, #aref_prefix,
#marshal_dump

TODO: filter included items by #display?

#marshal_load,
#merge_collections

Merges collection mine with other preferring other.

#merge_sections

Merges the comments in this ClassModule with the comments in the other ClassModule cm.

#remove_things, #to_s

Context - Inherited

#<=>

Contexts are sorted by full_name.

#add

Adds an item of type klass with the given name and comment to the context.

#add_alias

Adds an_alias that is automatically resolved.

#add_attribute

Adds attribute if not already there.

#add_class

Adds a class named given_name with #superclass.

#add_class_or_module

Adds the class or module mod to the modules or classes Hash self_hash, and to all_hash (either TopLevel.modules_hash or TopLevel.classes_hash), unless #done_documenting is true.

#add_constant

Adds constant if not already there.

#add_extend

Adds extension module ext which should be an Extend

#add_include

Adds included module include which should be an Include

#add_method

Adds method if not already there.

#add_module

Adds a module named name.

#add_module_alias

Adds an alias from from (a class or module) to name which was defined in file.

#add_module_by_normal_module

Adds a module by NormalModule instance.

#add_require

Adds require to this context’s top level.

#add_section

Returns a section with title, creating it if it doesn’t already exist.

#add_to

Adds thing to the collection array

#any_content

Is there any content?

#child_name

Creates the full name for a child with name

#class_attributes

Class attributes.

#class_method_list

Class methods.

#classes

Array of classes in this context.

#classes_and_modules

All classes and modules in this namespace.

#classes_hash

Hash of classes keyed by class name.

#defined_in?

Is part of this thing was defined in file?

#each_attribute

Iterator for attributes.

#each_classmodule

Iterator for classes and modules.

#each_constant

Iterator for constants.

#each_extend

Iterator for extension modules.

#each_include

Iterator for included modules.

#each_method

Iterator for methods.

#each_section

Iterator for each section’s contents sorted by title.

#find_attribute

Finds an attribute name with singleton value singleton.

#find_attribute_named

Finds an attribute with name in this context.

#find_class_method_named

Finds a class method with name in this context.

#find_constant_named

Finds a constant with name in this context.

#find_enclosing_module_named

Find a module at a higher scope.

#find_external_alias

Finds an external alias name with singleton value singleton.

#find_external_alias_named

Finds an external alias with name in this context.

#find_file_named

Finds a file with name in this context.

#find_instance_method_named

Finds an instance method with name in this context.

#find_local_symbol

Finds a method, constant, attribute, external alias, module or file named symbol in this context.

#find_method

Finds a method named name with singleton value singleton.

#find_method_named

Finds a instance or module method with name in this context.

#find_module_named

Find a module with name using ruby’s scoping rules.

#find_symbol

Look up symbol, first as a module, then as a local symbol.

#find_symbol_module

Look up a module named symbol.

#full_name

The full name for this context.

#http_url

URL for this with a prefix

#initialize_methods_etc

Sets the defaults for methods and so-forth.

#instance_attributes

Instance attributes.

#instance_method_list

Instance methods.

#methods_by_type

Breaks method_list into a nested hash by type ('class' or 'instance') and visibility (:public, :protected, :private).

#methods_matching

Yields AnyMethod and Attr entries matching the list of names in methods.

#modules

Array of modules in this context.

#modules_hash

Hash of modules keyed by module name.

#name_for_path

Name to use to generate the url.

#record_location

Record top_level as a file self is in.

#remove_invisible

Removes methods and attributes with a visibility less than min_visibility.

#resolve_aliases

Tries to resolve unmatched aliases when a method or attribute has just been added.

#section_contents

Returns Context::Section objects referenced in this context for use in a table of contents.

#sections

Sections in this context.

#set_constant_visibility_for

Given an array names of constants, set the visibility of each constant to visibility

#set_current_section

Sets the current section to a section with title.

#set_visibility_for

Given an array methods of method names, set the visibility of each to visibility

#sort_sections

Sorts sections alphabetically (default) or in TomDoc fashion (none, Public, Internal, Deprecated).

#top_level

Return the TopLevel that owns us.

#upgrade_to_class

Upgrades NormalModule mod in enclosing to a class_type

#display,
#each_ancestor

Iterator for ancestors for duck-typing.

#remove_invisible_in

Only called when min_visibility == :public or :private.

#sections_hash, #to_s

CodeObject - Inherited

#each_parent

Yields each parent of this CodeObject.

#file_name

File name where this CodeObject was found.

#ignore

Use this to ignore a CodeObject and all its children until found again (#record_location is called).

#options

The options instance from the store this CodeObject is attached to, or a default options instance if the CodeObject is not attached.

#parent_file_name

File name of our parent.

#parent_name

Name of our parent.

#record_location

Records the TopLevel (file) where this code object was defined.

#start_doc

Enable capture of documentation unless documentation has been turned off by :enddoc:

#stop_doc

Disable capture of documentation.

#suppress

Use this to suppress a CodeObject and all its children until the next file it is seen in or documentation is discovered.

#initialize_visibility

Initializes state for visibility of this CodeObject and its children.

Generator::Markup - Included

#aref_to

Generates a relative URL from this object’s path to target_path

#as_href

Generates a relative URL from from_path to this object’s path.

#cvs_url

Build a webcvs URL starting for the given url with full_path appended as the destination path.

#description

Handy wrapper for marking up this object’s comment.

#formatter

Creates an Markup::ToHtmlCrossref formatter.

Text - Included

#expand_tabs

Expands tab characters in text to eight spaces.

#flush_left

Flush text left based on the shortest line.

#markup

Convert a string in markup format into HTML.

#normalize_comment

Strips hashes, expands tabs then flushes text to the left.

#parse

Normalizes text then builds a Markup::Document from it.

#snippet

The first limit characters of text as HTML.

#strip_hashes

Strips leading # characters from text

#strip_newlines

Strips leading and trailing n characters from text

#strip_stars

Strips /* */ style comments.

#to_html

Converts ampersand, dashes, ellipsis, quotes, copyright and registered trademark symbols in text to properly encoded characters.

#wrap

Wraps txt to line_len

Constructor Details

This class inherits a constructor from RDoc::ClassModule

Instance Attribute Details

#module?Boolean (readonly)

This is a module, returns true

[ GitHub ]

  
# File 'lib/rdoc/normal_module.rb', line 28

def module?
  true
end

Instance Method Details

#aref_prefix

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rdoc/normal_module.rb', line 7

def aref_prefix # :nodoc:
  'module'
end

#definition

The definition of this module, module MyModuleName

[ GitHub ]

  
# File 'lib/rdoc/normal_module.rb', line 21

def definition
  "module #{full_name}"
end

#inspect

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rdoc/normal_module.rb', line 11

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

#pretty_print(q)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rdoc/normal_module.rb', line 32

def pretty_print q # :nodoc:
  q.group 2, "[module #{full_name}: ", "]" do
    q.breakable
    q.text "includes:"
    q.breakable
    q.seplist @includes do |inc| q.pp inc end
    q.breakable

    q.breakable
    q.text "constants:"
    q.breakable
    q.seplist @constants do |const| q.pp const end

    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

#superclass

Modules don’t have one, raises NoMethodError

Raises:

  • (NoMethodError)
[ GitHub ]

  
# File 'lib/rdoc/normal_module.rb', line 69

def superclass
  raise NoMethodError, "#{full_name} is a module"
end