Method: RDoc::Markup::Document#merge
- Defined in:
- lib/rdoc/markup/document.rb
#merge(other) ⇒ Object
When this is a collection of documents (#file is not set and this document contains only other documents as its direct children) #merge replaces documents in this class with documents from other
when the file matches and adds documents from other
when the files do not.
The information in other
is preferred over the receiver
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/rdoc/markup/document.rb', line 114 def merge other if empty? then @parts = other.parts return self end other.parts.each do |other_part| self.parts.delete_if do |self_part| self_part.file and self_part.file == other_part.file end self.parts << other_part end self end |