Sha256: 089501c814693ef06189ad475d9a9a8d594d9c648dafc8bcbb685f88d89b8c30
Contents?: true
Size: 903 Bytes
Versions: 1
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-2013 Ivan Kuchin. See LICENSE.txt for details.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
in_threads-1.1.2 | README.markdown |