J
Jarmo Pertman
I wanted to use threadify to iterate over my data structure, where
inside array I have hashes, but it seems that threadify produces
different results than #each.
Here is code sample:
require 'threadify'
a = []
b = {:key => "value"}
a << b
a.each {|c| p c}
a.threadify {|c| p c}
Output is:
{:key=>"value"}
[:key, "value"]
Now, if I have multiple key, value pairs in Hash, then I will get this
warning of course:
warning: multiple values for a block parameter (2 for 1)
Why isn't threadify working as expected? It seems as it's iterating over
array and hash instead of just over array.
Jarmo
inside array I have hashes, but it seems that threadify produces
different results than #each.
Here is code sample:
require 'threadify'
a = []
b = {:key => "value"}
a << b
a.each {|c| p c}
a.threadify {|c| p c}
Output is:
{:key=>"value"}
[:key, "value"]
Now, if I have multiple key, value pairs in Hash, then I will get this
warning of course:
warning: multiple values for a block parameter (2 for 1)
Why isn't threadify working as expected? It seems as it's iterating over
array and hash instead of just over array.
Jarmo