From: joshua.goodall@... Date: 2018-01-11T21:32:48+00:00 Subject: [ruby-core:84840] [Ruby trunk Feature#14197] `Enumerable#{select, reject}` accept a pattern argument Issue #14197 has been updated by inopinatus (Joshua GOODALL). I have personally found it useful to implement Regexp#to_proc as in https://bugs.ruby-lang.org/issues/7883 which permits collection.reject(&/re/) and more besides. ---------------------------------------- Feature #14197: `Enumerable#{select,reject}` accept a pattern argument https://bugs.ruby-lang.org/issues/14197#change-69553 * Author: znz (Kazuhiro NISHIYAMA) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- `#all?`, `#any?`, `#none?`, and `#one?` accept a pattern argument since 2.5.0. But `#select`, and `#reject` don't. The features are exist as `#grep`, and `#grep_v`, but there are hard to remember for me when I use `#select`, or `#reject`. So I want to write ```ruby collection.reject(/re/) ``` instead of ```ruby collection.reject {|item| /re/ =~ item } ``` nor ```ruby collection.grep_v(/re/) ``` -- https://bugs.ruby-lang.org/ Unsubscribe: