From: Raf Coremans Date: 2007-06-21T04:22:41+09:00 Subject: Re: if == any item in an array ------=_Part_61138_920631.1182367353469 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 2007/6/20, 12 34 : > > I'd like to write something like > > PhotoEndings = %w[JPG,MRW,JPE] > MovieEndings = %w[AVI] > case ext # determined from the photo file name > when PhotoEndings > > when MovieEndings > > else > end > > I don't have to use case, any conditional will do. > > Thanks. I hope I have explained this. I have no idea what to search for. > I did try some, but I'm a newbie and don't understand the more advanced > syntax. > > I tried > when PhotoEndings.any > and > when PhotoEndings.or > > Wild guesses, but they don't work. > > -- > Posted via http://www.ruby-forum.com/. > > You could use regular expressions: PhotoEndings = /JPG|MRW|JPE/i MovieEndings = /AVI/i case ext when PhotoEndings when MovieEndings else end Regards, Raf ------=_Part_61138_920631.1182367353469--