method

dump

v2_1_10 - Show latest stable - Class: String
dump()
public

Produces a version of str with all non-printing characters replaced by nnn notation and all special characters escaped.

"hello \n ''".dump  #=> "\"hello \\n ''\"