APIdock / Ruby
/
method

merge

ruby latest stable - Class: RDoc ::ClassModule
merge(class_module)
public

Merges class_module into this ClassModule.

The data in class_module is preferred over the receiver.

# File lib/rdoc/class_module.rb, line 435
 def merge class_module
 @parent = class_module.parent
 @parent_name = class_module.parent_name
 other_document = parse class_module.comment_location
 if other_document then
 document = parse @comment_location
 document = document.merge other_document
 @comment = @comment_location = document
 end
 cm = class_module
 other_files = cm.in_files
 merge_collections attributes, cm.attributes, other_files do |add, attr|
 if add then
 add_attribute attr
 else
 @attributes.delete attr
 @methods_hash.delete attr.pretty_name
 end
 end
 merge_collections constants, cm.constants, other_files do |add, const|
 if add then
 add_constant const
 else
 @constants.delete const
 @constants_hash.delete const.name
 end
 end
 merge_collections includes, cm.includes, other_files do |add, incl|
 if add then
 add_include incl
 else
 @includes.delete incl
 end
 end
 @includes.uniq! # clean up
 merge_collections extends, cm.extends, other_files do |add, ext|
 if add then
 add_extend ext
 else
 @extends.delete ext
 end
 end
 @extends.uniq! # clean up
 merge_collections method_list, cm.method_list, other_files do |add, meth|
 if add then
 add_method meth
 else
 @method_list.delete meth
 @methods_hash.delete meth.pretty_name
 end
 end
 merge_sections cm
 self
 end

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