Pluck Property

Extract a specific property value from each object in an array.

Code

General
arr.map { |item| item[key] }

Parameters

Array of objects

Property to extract

Server

More Ruby Snippets