There seems to be a bug with Emacs mode of Ruby:

For example:
I have following three statements and Emacs behaves quite differently
with each of them

# this work pretty fine actually
return 1 if @chunked_data !~ /SESSID/


# indentation is pretty screwed up actually
return $& if @chunked_data !~ /SESSID/
          # Emacs thinks this as the beginning of the next statement

#again indentation of subsequent lines get screwed up
return "hi" if @chunked_data =~  /(?:SESSID=)(\w+)(?:,|\#\#)/
   # Emacs thinks this as the beginning of the next statement




-- 
There was only one Road; that it was like a great river: its springs
were at every doorstep, and every path was its tributary.