I have this data:
members = {"total"=>3, "data"=>[
{"email"=>"[email protected]", "timestamp"=>"2013-03-16 01:11:01"},
{"email"=>"[email protected]", "timestamp"=>"2013-03-16 02:07:30"},
{"email"=>"[email protected]", "timestamp"=>"2013-03-16 03:06:24"}
]}
And want to generate an array like:
["[email protected]", "[email protected]", "[email protected]"]
Currently I'm using:
members['data'].collect { |h| h['email'] }
- Is there a more efficient way to achieve it in regards to performance?
- Is there an even shorter way to achieve it?
I have Rails available.