Given an really big array/hash, for example, users:
users = [
{ 'user': 'barney', 'age': 36 },
{ 'user': 'jeff', 'age': 32 },
...
{ 'user': 'fred', 'age': 40 }
];
If you apply Lodash's pluck
function*:
_.pluck(users, 'user');
You get this result:
-> ['barney', 'jeff', ..., 'fred']
Does Ruby have a similarly convenient function that will get only a certain key of the array/hash without iterating it? I know Rails has a function called pluck but it is for ActiveRecords. Any suggestions for how to accomplish this on arrays?
*pluck
was apparently replaced by map
since this question was written