aboutsummaryrefslogtreecommitdiff
path: root/ruby/printer.rb
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-10 22:24:58 -0500
committerJoel Martin <github@martintribe.org>2014-04-10 22:24:58 -0500
commit8bf53bec72d27d7d895b39812ffae1e990425158 (patch)
treea658f2900b9ceff44522780b3d5c28afb1abf0e2 /ruby/printer.rb
parentb5f469de182a3e95b2d968ddccf2e2f9b77a3dc2 (diff)
downloadmal-8bf53bec72d27d7d895b39812ffae1e990425158.tar.gz
mal-8bf53bec72d27d7d895b39812ffae1e990425158.zip
Ruby: step4_if_fn_do with core functions.
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