From: ruby-core@... Date: 2019-06-12T14:20:58+00:00 Subject: [ruby-core:93077] [Ruby trunk Bug#15918] Pattern matching for Set Issue #15918 has been updated by marcandre (Marc-Andre Lafortune). Eregon (Benoit Daloze) wrote: > Did you mean `in Set[1, 2, 3]` ? I didn't, but it should match too; it's the same as my example but with the added constraint that the object should be a descendant a `Set`. Note that `in Set[1, 2, 3]` does *not* call `Set.[](1, 2, 3)`... ---------------------------------------- Bug #15918: Pattern matching for Set https://bugs.ruby-lang.org/issues/15918#change-78490 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Currently, `Set` does not respond to `deconstruct`. Shouldn't we implement it using `to_a`? ``` require 'set' case Set[1, 2, 3] in [1, 2, 3] p "match" else p "no match" end # => "no match", should be "match" ``` -- https://bugs.ruby-lang.org/ Unsubscribe: