Forum: Ruby threadify not handling hashes inside of array correctly

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ff97ca87af59ee68ceff5877a8365788?d=identicon&s=25 Jarmo Pertman (juuser)
on 2009-05-27 13:46
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"]

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.

Ff97ca87af59ee68ceff5877a8365788?d=identicon&s=25 Jarmo Pertman (juuser)
on 2009-06-02 20:39
Forwarding conversationg with threadify's author Ara T. Howard to the

On Tue, Jun 2, 2009 at 12:08 PM, Jarmo wrote:
> > Hello.
> >
> > Do you still care about threadify and it's problems? I've posted into
> > Ruby list about one problem, but no-one doesn't seem to bother to
> > answer. I've searched for you as an author of this great library to see
> > if you have any ideas about this problem.
> >
> > You can read about it more from here:
> >
> >
> > I would be grateful if you'd help me, but if you have something better
> > to do then I'd also understand. Please just give me at least some answer  :)
> >
> > BR,
> > Jarmo

i'm not on the list often these days - sorry i missed it.


pls relay to list.

-- be kind whenever possible... it is always possible - h.h. the 14th
dalai lama
This topic is locked and can not be replied to.