Project

General

Profile

Actions

Feature #15918

open

Pattern matching for Set

Added by marcandre (Marc-Andre Lafortune) almost 5 years ago. Updated over 4 years ago.

Status:
Open
Target version:
-
[ruby-core:93075]

Description

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"

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #14912: Introduce pattern matching syntaxClosedktsj (Kazuki Tsujimoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0