> # Inside a string in #{} - bombs
>>> "hi #{'a'.gsub("'",'\\\'')}"
> [just waits for another "]
> "
> SyntaxError: compile error
> (irb):20: unterminated string meets end of file
>  

Looks like a bug in irb's internal "am I done with a complete
expression" parser, since it works if within a .rb script.
=r