From: Ben Thomas Date: 2003-03-13T01:37:03+09:00 Subject: Re: a newbie question Thankx all for the answers. Think I'm gonna read on === since its something I don't even use in my ruby script :) Ben. Joel VanderWerf wrote: > 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"] > > >