How does Ruby compare strings?

maybe someone knows the technical answer to the following behaviour:

s = "hello world!"
s == s.upcase
# =>false, because "hello world!" != "HELLO WORLD!"
s == s.upcase!
#=>true, because s is changed before comparison?

Mathias

How does Ruby compare strings?