I have this data:
members = {"total"=>3, "data"=>[
{"email"=>"foo@example.org", "timestamp"=>"2013-03-16 01:11:01"},
{"email"=>"bar@example.org", "timestamp"=>"2013-03-16 02:07:30"},
{"email"=>"exx@example.org", "timestamp"=>"2013-03-16 03:06:24"}
]}
And want to generate an array like:
["foo@example.org", "bar@example.org", "exx@example.org"]
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.