Hi,
----- Original Message ----- 
From: "John Butler" <johnnybutler7 / gmail.com>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Friday, April 11, 2008 7:05 PM
Subject: Match string from possible strings


> Hi,
> 
> Ive looked about and found some ways to do this but there must be a 1
> line quick way in ruby using regular expressions or something.
> 
> Basically i have a string "Test" and i want to see if it matches 3
> constants that i have defined.  If it does then i want to go route a,
> and if it doesnt i want to go route b,  so:
> 
> If "Test" (matches either of the following) string1, string2, string3
> route a
> else
> route b
> end
> 
> Anyone know the quick way?
> 
> JB

Is this what you want?

if [string1,string2,string3].include?("Test")
...

Regards,
Park Heesob