aboutsummaryrefslogtreecommitdiff
path: root/ruby/printer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/printer.rb')
-rw-r--r--ruby/printer.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/ruby/printer.rb b/ruby/printer.rb
index 2d46e07..424ca23 100644
--- a/ruby/printer.rb
+++ b/ruby/printer.rb
@@ -9,9 +9,7 @@ def _pr_str(obj, print_readably=true)
"[" + obj.map{|x| _pr_str(x, _r)}.join(" ") + "]"
when String
if _r
- "\"" + obj.gsub(/\\/, "\\\\") \
- .gsub(/"/, "\\\\\"") \
- .gsub(/\n/, "\\\\n") + "\""
+ obj.inspect # escape special characters
else
obj
end