From: knu@... Date: 2020-11-18T13:48:18+00:00 Subject: [ruby-core:100933] [Ruby master Feature#17333] Enumerable#many? Issue #17333 has been updated by knu (Akinori MUSHA). ITYM `> 1`. ���� ---------------------------------------- Feature #17333: Enumerable#many? https://bugs.ruby-lang.org/issues/17333#change-88585 * Author: okuramasafumi (Masafumi OKURA) * Status: Open * Priority: Normal ---------------------------------------- `Enumerable#many?` method is implemented in ActiveSupport. https://api.rubyonrails.org/classes/Enumerable.html#method-i-many-3F However, it's slightly different from Ruby's core methods such as `one?` or `all?`, where they take pattern argument. I believe these methods should behave the same so that it's easier to guess and learn. We already have `none?`, `one?`, `any?` and `all?`, which translate into `== 0`, `== 1`, `> 0` and `== self.size`. `many?` method translates into `> 1`, which is reasonable to exist. Currently we need to write something this: ```ruby [1, 2, 3].count(&:odd?).size >= 1 ``` With `many?`, we can make it much simpler: ```ruby [1, 2, 3].many?(&:odd?) ``` -- https://bugs.ruby-lang.org/ Unsubscribe: