class RDoc::ClassModule

def merge_sections(cm) # :nodoc:

:nodoc:
def merge_sections(cm) # :nodoc:
  my_sections    =    sections.group_by { |section| section.title }
  other_sections = cm.sections.group_by { |section| section.title }
  other_files = cm.in_files
  remove_things my_sections, other_files do |_, section|
    @sections.delete section.title
  end
  other_sections.each do |group, sections|
    if my_sections.include? group
      my_sections[group].each do |my_section|
        other_section = cm.sections_hash[group]
        my_comments    = my_section.comments
        other_comments = other_section.comments
        other_files = other_section.in_files
        merge_collections my_comments, other_comments, other_files do |add, comment|
          if add then
            my_section.add_comment comment
          else
            my_section.remove_comment comment
          end
        end
      end
    else
      sections.each do |section|
        add_section group, section.comments
      end
    end
  end
end