Use the ruby-pool gem.
Been using it for a couple of months and love it!
Let me know if you have any questions!
Example Code
require 'thread/pool'
pool = Thread.pool(5)
all_files.each do |f|
pool.process {
# Do Stuff
}
end
pool.shutdown