From: Bil Kleb Date: 2008-01-13T00:24:57+09:00 Subject: refactoring request 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, -- Bil Kleb http://fun3d.larc.nasa.gov