B
Bil Kleb
Hi,
I've stalled out on making this simpler, and I'm
seeking help pairing this beast down...
Given unused is a hash of arrays where each array has
repeated elements, make elements unique in each array and
remove all names that are not repeated MagicNumber times.
Finally, remove any hash pairs that hold an empty array.
unused.each do |source,routines|
orphans = routines.uniq
orphans.delete_if do |orphan|
repeated = routines.find_all{ |routine| routine == orphan }.size
repeated != MagicNumber
end
unused[source] = orphans
end
unused.delete_if{ |h,k| k.empty? }
Thanks,
I've stalled out on making this simpler, and I'm
seeking help pairing this beast down...
Given unused is a hash of arrays where each array has
repeated elements, make elements unique in each array and
remove all names that are not repeated MagicNumber times.
Finally, remove any hash pairs that hold an empty array.
unused.each do |source,routines|
orphans = routines.uniq
orphans.delete_if do |orphan|
repeated = routines.find_all{ |routine| routine == orphan }.size
repeated != MagicNumber
end
unused[source] = orphans
end
unused.delete_if{ |h,k| k.empty? }
Thanks,