Ah, I found it! gsub!- a very strange method. First, it replaces the string in place, so it actually modifies your string. Secondly, it returns nilwhen no replacement has been made. All this adds up to the error you receive.
, , , , "replace this 3 and name". , gsub , , . gsub .
, - , . ( ). , gsub (no bang). , .