arr = [
{
:id=>2,
:start=> "3:30",
break: 30,
num_attendees: 14
},
{
id: 3,
start: "3: 40",
break: 40,
num_attendees: 4
},
{
id: 4,
start: "4: 40",
break: 10,
num_attendees: 40
}
]
When I do the following
arr.map do |hash|
[ hash[:id], hash[:start] ]
end
returns
#=> [[2, "3:30"], [3, "3: 40"], [4, "4: 40"]]
Is there an elegant and efficient way of passing an array like return_keys = [:id, :start] and get the same above values rather than hard coding inside the array.map