From: Joel VanderWerf Date: 2003-03-12T10:00:10+09:00 Subject: Re: a newbie question Gennady wrote: > That's what I've been missing in Ruby!!! Thank you very much, Daniel (and > Matz, of course). I just verified that Enumerable#grep simply invokes method > "===" on its parameter for every element, and that's exactly what I usually > need. And with an optional block you get "selective collect" functionality. > This is so great!!! === is one of the unsung heroes of ruby. It's a protocol that unifies grep and case into a general notion of pattern matching. Here's one use I like: irb> [1,2,"345","678"].grep String ["345", "678"]