Skip to content

Instantly share code, notes, and snippets.

View peteonrails's full-sized avatar

Peter Jackson peteonrails

View GitHub Profile
require "threaded_collections"
threadcount = 2
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
tps = ThreadedCollectionProcessor.new(arr)
tps.process(2) { |thread_id, item| puts "Thread #{thread_id} processed item: #{item}" }