stdlib/string/dump.rb
tests/_examples/stdlib/string/dump.rb in the metorex repository.
puts "plain".dump
puts "with \"quotes\"".dump
puts "tab\there".dump
puts "line\nbreak".dump
puts "back\\slash".dump
puts 'interp #{x} and #@ivar'.dump
puts "café".dump
Output:
"plain"
"with \"quotes\""
"tab\there"
"line\nbreak"
"back\\slash"
"interp \#{x} and \#@ivar"
"caf\u00E9"