Sha256: 51f52692c9b7e46e60947b92a2e5673fd3b21116244a3128e7b9a81585466399
Contents?: true
Size: 903 Bytes
Versions: 3
Compression:
Stored size: 903 Bytes
Contents
# in_threads Easily execute ruby code in parallel. ## Installation gem install in_threads ## Usage By default there is maximum of 10 simultaneous threads urls.in_threads.map do |url| url.fetch end urls.in_threads.each do |url| url.save_to_disk end numbers.in_threads(2).map do |number| # whery long and complicated formula # using only 2 threads end You can use any Enumerable method, but some of them can not use threads (`inject`, `reduce`) or don't use blocks (`to_a`, `entries`, `drop`, `take`, `first`, `include?`, `member?`) or have both problems depending on usage type (`min`, `max`, `minmax`, `sort`) urls.in_threads.any?(&:ok?) urls.in_threads.all?(&:ok?) urls.in_threads.none?(&:error?) urls.in_threads.grep(/example\.com/, &:fetch) ## Copyright Copyright (c) 2010-2011 Ivan Kuchin. See LICENSE.txt for details.
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
in_threads-1.1.1 | README.markdown |
in_threads-1.1.0 | README.markdown |
in_threads-1.0.0 | README.markdown |