Add an option to escape forward slash character

Squashed commit of the following:

commit 26d181059989279a79c433cedcd893b4f52e42ee
Author: Francois Chagnon <francois.chagnon@jadedpixel.com>
Date:   Tue Sep 15 21:17:34 2015 +0000

    add config options for escape_slash

commit fa282334051b16df91ca097dd7304b46f3bc7719
Author: Francois Chagnon <francois.chagnon@jadedpixel.com>
Date:   Mon Feb 9 21:09:33 2015 +0000

    add forward slash to escape character
This commit is contained in:
Jean Boussier 2020-01-30 12:48:05 +01:00 committed by Hiroshi SHIBATA
parent c5ea060ef8
commit e1659af372
Notes: git 2020-09-25 17:29:15 +09:00
5 changed files with 66 additions and 8 deletions

View file

@ -593,12 +593,13 @@ module JSON
# Sets or returns the default options for the JSON.dump method.
# Initially:
# opts = JSON.dump_default_options
# opts # => {:max_nesting=>false, :allow_nan=>true}
# opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false}
attr_accessor :dump_default_options
end
self.dump_default_options = {
:max_nesting => false,
:allow_nan => true,
:escape_slash => false,
}
# Dumps _obj_ as a JSON string, i.e. calls generate on the object and returns