From: zverok.offline@... Date: 2019-11-11T15:08:05+00:00 Subject: [ruby-core:95790] [Ruby master Feature#16341] Proposal: Set#to_proc Issue #16341 has been updated by zverok (Victor Shepelev). Since 2.5, `Set` implements `#===`, so you can just: ```ruby (1..10).grep_v(banned_numbers) # => [1, 2, 3, 4, 6, 8, 10] ``` which is pretty clear and probably more effective than proc conversion. ---------------------------------------- Feature #16341: Proposal: Set#to_proc https://bugs.ruby-lang.org/issues/16341#change-82611 * Author: Nondv (Dmitry Non) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- ``` ruby class Set def to_proc -> (x) { include?(x) } # or method(:include?).to_proc end end ``` Usage: ```ruby require 'set' banned_numbers = Set[0, 5, 7, 9] (1..10).reject(&banned_numbers) # ===> [1, 2, 3, 4, 6, 8, 10] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: