I want to modify my array of hashes to facilitate better search performance
I have:
a = [ {"id" => 1, "name" => "Matt", "email" => "[email protected]"}, {"id" => 2, "name" => "Charlie", "email" => "[email protected]"} ]
I want to transform this into:
b = [ {1 => { "name" => "Matt", "email" => "[email protected]"}},{2 => { "name" => "Charlie", "email" => "[email protected]"}} ]
Note that the "id" field won't necessarily be a sequential or contiguous set, but each occurrence will be unique. Also, the hash nested as a value in b can contain 'id' key/value pair if that makes things easier.