Method: RDoc::Context#add_module_alias
- Defined in:
- lib/rdoc/code_object/context.rb
#add_module_alias(from, from_name, to, file) ⇒ Object
Adds an alias from from
(a class or module) to name
which was defined in file
.
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/rdoc/code_object/context.rb', line 527 def add_module_alias from, from_name, to, file return from if @done_documenting to_full_name = child_name to.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_full_name unless from @store.unmatched_constant_alias[child_name(from_name)] = [to, file] return to end new_to = from.dup new_to.name = to.name new_to.full_name = nil if new_to.module? then @store.modules_hash[to_full_name] = new_to @modules[to.name] = new_to else @store.classes_hash[to_full_name] = new_to @classes[to.name] = new_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 to.name, nil, new_to.comment const.record_location file const.is_alias_for = from add_constant const new_to end |