Most concise way to test string equality (not object equality) for Ruby strings or symbols?

Viewed 113064

I always do this to test string equality in Ruby:

if mystring.eql?(yourstring)
 puts "same"
else
 puts "different"
end

Is this is the correct way to do this without testing object equality?

I'm looking for the most concise way to test strings based on their content.

With the parentheses and question mark, this seems a little clunky.

2 Answers
Related