Hi,

On 09.06.2011 20:26, Marc-Andre Lafortune wrote:
> You might want to read the thread [ruby-core:33683] on Akira's
> proposal for Enumerable#categorize and my alternative proposal
> Enumerable#associate which would act as a more versatile
> Enumerable#to_hash.
> 
> Your input could have more impact on that thread than on this one.
> Hopefully we can come up with a neat functionality for the some future
> version of Ruby.

Thanks for the pointer, very informative. I choose not to add anything
to the other thread, as it seems they goal is a bit different.

My one and only intention is really simple: provide the reverse of
Hash#to_a ("Converts hsh to a nested array of [ key, value ] arrays.") ;
e.g. Array#to_h .

I understood from the other thread much more flexible solutions where
sought, nothing I could aid anything valuable I fear.

I'm just a novice when it comes to Ruby and found a frequent need for
that functionality; maybe it's because of my non-Ruby background and
thus my non-Ruby approach. Likely also that it's not as simple as I
wished this could be, so far Hash[ ... ] was always the solution for me so

class Array ; def to_h ; Hash[ self ]; end; end

worked very well for me.

cheers,
- Markus