Issue #1695 has been updated by Run Paint Run Run.


Is the problem not simply the use of <"> inside the #gsub? 

Ruby expects delimiters to be matched. Your second double quotation mark terminates the String you began with the first; so the single quotation mark that immediately follows that is assumed to begin a new string. IOW, Ruby regards <"hi #{'a'.gsub("> as your first string, which is followed by <'",'>, which is followed by <\\\'')}">. Hence the syntax error.

If you want to do all of that on the same line, why not use alternative delimiters? For example:

%!hi #{'a'.gsub("'",'\\\'')}!  #=> "hi a"
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1695

----------------------------------------
http://redmine.ruby-lang.org