add_module_alias(from, name, file)public
Adds an alias from from (a class or module) to name which was defined in file.
# File lib/rdoc/context.rb, line 517
def add_module_alias from, name, file
return from if @done_documenting
to_name = child_name name
# if we already know this name, don't register an alias:
# see the metaprogramming in lib/active_support/basic_object.rb,
# where we already know BasicObject is a class when we find
# BasicObject = BlankSlate
return from if @store.find_class_or_module to_name
to = from.dup
to.name = name
to.full_name = nil
if to.module? then
@store.modules_hash[to_name] = to
@modules[name] = to
else
@store.classes_hash[to_name] = to
@classes[name] = to
end
# Registers a constant for this alias. The constant value and comment
# will be updated later, when the Ruby parser adds the constant
const = RDoc::Constant.new name, nil, to.comment
const.record_location file
const.is_alias_for = from
add_constant const
to
end Related methods
- Instance methods
- <=>
- 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
- current_section
- 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_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_constant_visibility_for
- set_current_section
- set_visibility_for
- sort_sections
- to_s
- top_level
- upgrade_to_class
- Class methods
- new