Project

General

Profile

Actions

Feature #15918

open

Pattern matching for Set

Added by marcandre (Marc-Andre Lafortune) over 2 years ago. Updated over 2 years ago.

Status:
Open
Priority:
Normal
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

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

Also available in: Atom PDF