Convert multi dimentional array to array of hashes


How can I turn and array like this this


into this



You can try something like that :

a = [[1,2,3,4,5],[1,2,3,4,5]]
a.transpose.collect {|e| {:lt => e.first, :ln => e.last} }

Aurélien AMILIN

Le 07/04/2010 11:24, All4miller All4miller a écrit :

thanks that worked great

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs