Module: Enumerable
- Defined in:
- lib/t/core_ext/enumerable.rb
Instance Method Summary collapse
Instance Method Details
#threaded_each ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/t/core_ext/enumerable.rb', line 3 def threaded_each threads = [] each do |object| threads << Thread.new{yield object} end threads.each(&:value) end |
#threaded_map ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/t/core_ext/enumerable.rb', line 11 def threaded_map threads = [] each do |object| threads << Thread.new{yield object} end threads.map(&:value) end |