Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

threadify not handling hashes inside of array correctly

1 view
Skip to first unread message

Jarmo Pertman

unread,
May 27, 2009, 7:46:52 AM5/27/09
to
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
--
Posted via http://www.ruby-forum.com/.

Jarmo Pertman

unread,
Jun 2, 2009, 2:39:31 PM6/2/09
to
Forwarding conversationg with threadify's author Ara T. Howard to the
list:

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:
> > http://groups.google.com/group/comp.lang.ruby/msg/1900149eb2817060
> >
> > 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.

fixed.

http://github.com/ahoward/threadify/tree/master

pls relay to list.


--
-a
-- be kind whenever possible... it is always possible - h.h. the 14th
dalai lama

0 new messages