File tree Expand file tree Collapse file tree 3 files changed +25
-15
lines changed
Expand file tree Collapse file tree 3 files changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -21,4 +21,4 @@ Gemfile.lock
2121.byebug_history
2222* .log
2323/tmp
24-
24+ / doc /
Original file line number Diff line number Diff line change 307307#
308308# ---
309309#
310+ # Option +allow_duplicate_key+ (boolean) specifies whether
311+ # hashes with duplicate keys should be allowed or produce an error.
312+ # defaults to emit a deprecation warning.
313+ #
314+ # With the default, (not set):
315+ # Warning[:deprecated] = true
316+ # JSON.generate({ foo: 1, "foo" => 2 })
317+ # # warning: detected duplicate key "foo" in {foo: 1, "foo" => 2}.
318+ # # This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true`
319+ # # => '{"foo":1,"foo":2}'
320+ #
321+ # With <tt>false</tt>
322+ # JSON.generate({ foo: 1, "foo" => 2 }, allow_duplicate_key: false)
323+ # # detected duplicate key "foo" in {foo: 1, "foo" => 2} (JSON::GeneratorError)
324+ #
325+ # In version 3.0, <tt>false</tt> will become the default.
326+ #
327+ # ---
328+ #
310329# Option +max_nesting+ (\Integer) specifies the maximum nesting depth
311330# in +obj+; defaults to +100+.
312331#
384403#
385404# == \JSON Additions
386405#
406+ # Note that JSON Additions must only be used with trusted data, and is
407+ # deprecated.
408+ #
387409# When you "round trip" a non-\String object from Ruby to \JSON and back,
388410# you have a new \String, instead of the object you began with:
389411# ruby0 = Range.new(0, 2)
Original file line number Diff line number Diff line change @@ -8,20 +8,8 @@ class State
88 #
99 # Instantiates a new State object, configured by _opts_.
1010 #
11- # _opts_ can have the following keys:
12- #
13- # * *indent*: a string used to indent levels (default: ''),
14- # * *space*: a string that is put after, a : or , delimiter (default: ''),
15- # * *space_before*: a string that is put before a : pair delimiter (default: ''),
16- # * *object_nl*: a string that is put at the end of a JSON object (default: ''),
17- # * *array_nl*: a string that is put at the end of a JSON array (default: ''),
18- # * *allow_nan*: true if NaN, Infinity, and -Infinity should be
19- # generated, otherwise an exception is thrown, if these values are
20- # encountered. This options defaults to false.
21- # * *ascii_only*: true if only ASCII characters should be generated. This
22- # option defaults to false.
23- # * *buffer_initial_length*: sets the initial length of the generator's
24- # internal buffer.
11+ # Argument +opts+, if given, contains a \Hash of options for the generation.
12+ # See {Generating Options}[#module-JSON-label-Generating+Options].
2513 def initialize ( opts = nil )
2614 if opts && !opts . empty?
2715 configure ( opts )
You can’t perform that action at this time.
0 commit comments