switch/case statement
case x
- Advanced techniques
when String
- matching object classwhen (1..10)
- matching rangeswhen /BAR$/
- matching regular expressionswhen -> (n) { n.to_s == "40" }
- Matching procs and lambdaswhen Success
- Writing your own matcher classes
simple as defining your own === method
Written on November 20, 2019, Last update on October 28, 2021
ruby