A more succinct idiom than the accepted answer above that's available in RailsRails (from 3.1.0 and above) is .in?
.
E.g:
my_string = "abcdefg"
if "cde".in? my_string
puts "'cde' is in the String."
puts "i.e. String includes 'cde'"
end
I also think it's more readable.
c.f.See the http://apidock.com/rails/v3.1.0/Object/in%3Fin?
documentation for more information.
(Note Note again that it's only available in RailsRails, and not pure Ruby.)