Sha256: 41f06c3b4747dd5b7898ef317c5c1285450b1b0d08cb8aa209ba49b14b7d9555
Contents?: true
Size: 347 Bytes
Versions: 2
Compression:
Stored size: 347 Bytes
Contents
module Twitter module Utils module_function def parallel_map(enumerable) # Don't bother spawning a new thread if there's only one item if enumerable.count == 1 enumerable.map { |object| yield object } else enumerable.map { |object| Thread.new { yield object } }.map(&:value) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twitter-5.5.1 | lib/twitter/utils.rb |
twitter-5.5.0 | lib/twitter/utils.rb |