[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

threadify not handling hashes inside of array correctly

Jarmo Pertman

5/27/2009 11:47:00 AM

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-....

1 Answer

Jarmo Pertman

6/2/2009 6:40:00 PM

0

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/190014...
> >
> > 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/t...

pls relay to list.


--
-a
-- be kind whenever possible... it is always possible - h.h. the 14th
dalai lama
--
Posted via http://www.ruby-....