method
from_module
v2_5_5 -
Show latest stable
- Class:
RDoc::ClassModule
from_module(class_type, mod)public
Return a RDoc::ClassModule of class class_type that is a copy of module module. Used to promote modules to classes.
# File lib/rdoc/class_module.rb, line 50
def self.from_module class_type, mod
klass = class_type.new mod.name
mod.comment_location.each do |comment, location|
klass.add_comment comment, location
end
klass.parent = mod.parent
klass.section = mod.section
klass.viewer = mod.viewer
klass.attributes.concat mod.attributes
klass.method_list.concat mod.method_list
klass.aliases.concat mod.aliases
klass.external_aliases.concat mod.external_aliases
klass.constants.concat mod.constants
klass.includes.concat mod.includes
klass.extends.concat mod.extends
klass.methods_hash.update mod.methods_hash
klass.constants_hash.update mod.constants_hash
klass.current_section = mod.current_section
klass.in_files.concat mod.in_files
klass.sections.concat mod.sections
klass.unmatched_alias_lists = mod.unmatched_alias_lists
klass.current_section = mod.current_section
klass.visibility = mod.visibility
klass.classes_hash.update mod.classes_hash
klass.modules_hash.update mod.modules_hash
klass.metadata.update mod.metadata
klass.document_self = mod.received_nodoc ? nil : mod.document_self
klass.document_children = mod.document_children
klass.force_documentation = mod.force_documentation
klass.done_documenting = mod.done_documenting
# update the parent of all children
(klass.attributes +
klass.method_list +
klass.aliases +
klass.external_aliases +
klass.constants +
klass.includes +
klass.extends +
klass.classes +
klass.modules).each do |obj|
obj.parent = klass
obj.full_name = nil
end
klass
end Related methods
- Instance methods
- add_comment
- add_things
- ancestors
- aref
- aref_prefix
- clear_comment
- comment=
- complete
- direct_ancestors
- document_self_or_methods
- documented?
- each_ancestor
- find_ancestor_local_symbol
- find_class_named
- full_name
- 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=
- to_s
- type
- update_aliases
- update_extends
- update_includes
- Class methods
- from_module
- new