instance method Enumerable#pluck
Enumerable#pluck(property) → Array
-
property
(String
) – The name of the property to fetch.
Pre-baked implementation for a common use-case of Enumerable#collect
and Enumerable#each
: fetching the same property for all of the
elements. Returns an array of the property values.
Example
['hello', 'world', 'this', 'is', 'nice'].pluck('length');
// -> [5, 5, 4, 2, 4]