This works for “none” but doesn’t seem to work for “bench”. I have
double checked to make sure the attribute is set to exactly ‘bench’ with
no spaces or case differences.
Is the condition syntax correct? can I go:
if x == (‘none’ || ‘one’ || ‘two’ || ‘three’)
or should I be doing it differently? I suppose I could be using a
regular expression but an even more desirable way would be to test a
string against a simple array of string options. I’ve thumbed through
my ruby books but couldn’t find the answer.
This works for “none” but doesn’t seem to work for “bench”. I have
double checked to make sure the attribute is set to exactly ‘bench’ with
no spaces or case differences.
for reference, the reason this doesn’t work is that ruby first evaluates
‘none’ || ‘one’ || ‘two’ || ‘three’
which evaluates to ‘none’ (since ‘none’ is not nil, the || stops there.
So the above is the same as if x == ‘none’