APIdock / Ruby
/
method

update_aliases

ruby latest stable - Class: RDoc ::ClassModule
update_aliases()
public

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

The aliased module/class is replaced in the children and in RDoc::Store#modules_hash or RDoc::Store#classes_hash by a copy that has RDoc::ClassModule#is_alias_for set to the aliased module/class, and this copy is added to #aliases of the aliased module/class.

Formatters can use the #non_aliases method to retrieve children that are not aliases, for instance to list the namespace content, since the aliased modules are included in the constants of the class/module, that are listed separately.

# File lib/rdoc/class_module.rb, line 743
 def update_aliases
 constants.each do |const|
 next unless cm = const.is_alias_for
 cm_alias = cm.dup
 cm_alias.name = const.name
 # Don't move top-level aliases under Object, they look ugly there
 unless RDoc::TopLevel === cm_alias.parent then
 cm_alias.parent = self
 cm_alias.full_name = nil # force update for new parent
 end
 cm_alias.aliases.clear
 cm_alias.is_alias_for = cm
 if cm.module? then
 @store.modules_hash[cm_alias.full_name] = cm_alias
 modules_hash[const.name] = cm_alias
 else
 @store.classes_hash[cm_alias.full_name] = cm_alias
 classes_hash[const.name] = cm_alias
 end
 cm.aliases << cm_alias
 end
 end

AltStyle によって変換されたページ (->オリジナル) /