Method: RDoc::ClassModule#merge_collections

Defined in:
lib/rdoc/class_module.rb

#merge_collections(mine, other, other_files, &block) ⇒ Object

Merges collection mine with other preferring other. other_files is used to help determine which items should be deleted.

Yields whether the item should be added or removed (true or false) and the item to be added or removed.

merge_collections things, other.things, other.in_files do |add, thing|
  if add then
    # add the thing
  else
    # remove the thing
  end
end


516
517
518
519
520
521
522
# File 'lib/rdoc/class_module.rb', line 516

def merge_collections mine, other, other_files, &block # :nodoc:
  my_things    = mine. group_by { |thing| thing.file }
  other_things = other.group_by { |thing| thing.file }

  remove_things my_things, other_files,  &block
  add_things    my_things, other_things, &block
end