From: non.dmitriy@... Date: 2019-11-11T15:02:27+00:00 Subject: [ruby-core:95789] [Ruby master Bug#16341] Proposal: Set#to_proc Issue #16341 has been reported by Nondv (Dmitriy Non). ---------------------------------------- Bug #16341: Proposal: Set#to_proc https://bugs.ruby-lang.org/issues/16341 * Author: Nondv (Dmitriy Non) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ``` 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: