aj0strow/async_enum — pull request #1 by yoshida-eth0 (2013-10-29 02:48:52+00:00)
Title: hash each args is not compatible

Hi AJ!

I want to async enumeration with hash.
But {}.async(number).each args and {}.async(nil).each args are not compatible.
In addition, a FiberError often raises when enumerate a hash.

h = {a: 123, b: 456}

h.async.each {|item| p item}
# => [:a, 123]
# => [:b, 456]

h.async(2).each {|item| p item}
# => :a
# => :b

# A FiberError often raises.
# /path/to/async_enum/lib/enumerator/async.rb:45:in `next': fiber called across threads (FiberError)
# from /path/to/async_enum/lib/enumerator/async.rb:45:in `block (3 levels) in each'
# from /path/to/async_enum/lib/enumerator/async.rb:44:in `loop'
# from /path/to/async_enum/lib/enumerator/async.rb:44:in `block (2 levels) in each'

So I try to fix.

Thanks.