From: marcandre-ruby-core@... Date: 2020-12-06T18:01:19+00:00 Subject: [ruby-core:101268] [Ruby master Feature#15975] Add Array#pluck Issue #15975 has been updated by marcandre (Marc-Andre Lafortune). Status changed from Open to Rejected Matz has already stated that it's a no, so I will close this. I'll add that the issue should not be about a shorthand to `map` and calling `[]` or `dig`, but how to write concisely `{|game| game[:steam_id]}`. As @inopinatus said, maybe a variant of `to_proc` could make this more conciser, but that is what `_1` is for. This is short and concise: ```ruby games.map{ _1[:steam_id] } ``` ---------------------------------------- Feature #15975: Add Array#pluck https://bugs.ruby-lang.org/issues/15975#change-88948 * Author: lewispb (Lewis Buckley) * Status: Rejected * Priority: Normal ---------------------------------------- Inspired by https://github.com/rails/rails/issues/20339 While developing web applications I've often wanted to quickly extract an array of values from an array of hashes. With an array of objects, this is possible: ```rb irb(main):001:0> require 'ostruct' => true irb(main):002:0> [OpenStruct.new(name: "Lewis")].map(&:name) => ["Lewis"] ``` This PR adds Array#pluck allowing this: ```rb irb(main):001:0> [ {name: "Lewis"} ].pluck(:name) => ["Lewis"] ``` without this PR: ```rb irb(main):001:0> [ {name: "Lewis"} ].map { |item| item[:name] } => ["Lewis"] ``` Implemented here: https://github.com/ruby/ruby/pull/2263 -- https://bugs.ruby-lang.org/ Unsubscribe: