Pattern Matching - New feature in Ruby 2.7
summary
Ruby 2.7 ships an experimental pattern matching feature that extends case with case/in and raises NoMatchingPatternError when none match; it implements value, variable, alternative, AS, array and hash patterns, supports guards and a pin operator (caret), and relies on new hooks like deconstruct and deconstruct_keys. The design trades compatibility and duck‑typing for ergonomics, and the deconstruct_keys optimization avoids returning ~40 Time fields at once at the cost of more complex implementation.
AI-written summary · about
chapters (14)
- 0:00Intro
- 0:21SELF INTRODUCTION
- 1:32AGENDA
- 1:57WHAT IS PATTERN MATCHING?
- 4:41EXAMPLE
- 7:46VALUE PATTERN
- 8:14VARIABLE PATTERN
- 10:53ALTERNATIVE PATTERN
- 11:08AS PATTERN
- 12:28ARRAY PATTERN
- 18:28HASH PATTERN
- 26:06KEEP COMPATIBILITY: SYNTAX
- 28:15KEEP COMPATIBILITY: NAMESPACE
- 32:56FUTURE WORKS








