oj 3.16.1 → 3.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/ext/oj/cache.c +4 -2
- data/ext/oj/cache.h +3 -2
- data/ext/oj/dump.c +39 -16
- data/ext/oj/extconf.rb +1 -2
- data/ext/oj/fast.c +10 -9
- data/ext/oj/intern.c +23 -6
- data/ext/oj/mimic_json.c +3 -3
- data/ext/oj/object.c +13 -5
- data/ext/oj/oj.c +131 -130
- data/ext/oj/oj.h +4 -3
- data/ext/oj/parser.c +67 -53
- data/ext/oj/parser.h +2 -2
- data/ext/oj/rails.c +23 -6
- data/ext/oj/reader.c +1 -1
- data/ext/oj/saj.c +2 -2
- data/ext/oj/stream_writer.c +35 -15
- data/ext/oj/string_writer.c +50 -16
- data/ext/oj/usual.c +20 -27
- data/ext/oj/usual.h +1 -0
- data/ext/oj/val_stack.c +13 -2
- data/lib/oj/schandler.rb +5 -4
- data/lib/oj/version.rb +1 -1
- data/test/activesupport6/encoding_test.rb +63 -28
- data/test/activesupport7/encoding_test.rb +72 -22
- data/test/foo.rb +3 -9
- data/test/json_gem/json_generator_test.rb +6 -0
- data/test/perf_dump.rb +1 -1
- data/test/prec.rb +4 -4
- data/test/test_custom.rb +2 -1
- data/test/test_object.rb +14 -0
- data/test/test_parser_debug.rb +1 -1
- data/test/test_parser_usual.rb +10 -0
- metadata +17 -3
    
        data/ext/oj/oj.c
    CHANGED
    
    | @@ -33,10 +33,10 @@ ID oj_array_append_id; | |
| 33 33 | 
             
            ID oj_array_end_id;
         | 
| 34 34 | 
             
            ID oj_array_start_id;
         | 
| 35 35 | 
             
            ID oj_as_json_id;
         | 
| 36 | 
            -
            ID oj_at_id;
         | 
| 37 36 | 
             
            ID oj_begin_id;
         | 
| 38 37 | 
             
            ID oj_bigdecimal_id;
         | 
| 39 38 | 
             
            ID oj_end_id;
         | 
| 39 | 
            +
            ID oj_eofq_id;
         | 
| 40 40 | 
             
            ID oj_exclude_end_id;
         | 
| 41 41 | 
             
            ID oj_error_id;
         | 
| 42 42 | 
             
            ID oj_file_id;
         | 
| @@ -51,6 +51,7 @@ ID oj_json_create_id; | |
| 51 51 | 
             
            ID oj_length_id;
         | 
| 52 52 | 
             
            ID oj_new_id;
         | 
| 53 53 | 
             
            ID oj_parse_id;
         | 
| 54 | 
            +
            ID oj_plus_id;
         | 
| 54 55 | 
             
            ID oj_pos_id;
         | 
| 55 56 | 
             
            ID oj_raw_json_id;
         | 
| 56 57 | 
             
            ID oj_read_id;
         | 
| @@ -91,9 +92,7 @@ VALUE oj_array_class_sym; | |
| 91 92 | 
             
            VALUE oj_create_additions_sym;
         | 
| 92 93 | 
             
            VALUE oj_decimal_class_sym;
         | 
| 93 94 | 
             
            VALUE oj_hash_class_sym;
         | 
| 94 | 
            -
            VALUE oj_in_sym;
         | 
| 95 95 | 
             
            VALUE oj_indent_sym;
         | 
| 96 | 
            -
            VALUE oj_nanosecond_sym;
         | 
| 97 96 | 
             
            VALUE oj_object_class_sym;
         | 
| 98 97 | 
             
            VALUE oj_quirks_mode_sym;
         | 
| 99 98 | 
             
            VALUE oj_safe_sym;
         | 
| @@ -240,72 +239,82 @@ struct _options oj_default_options = { | |
| 240 239 | 
             
             *	call-seq: default_options()
         | 
| 241 240 | 
             
             *
         | 
| 242 241 | 
             
             * Returns the default load and dump options as a Hash. The options are
         | 
| 243 | 
            -
             * - *:indent* [_Fixnum_|_String_|_nil_] number of spaces to indent each element | 
| 244 | 
            -
             *document, zero or nil is no newline between JSON elements, | 
| 245 | 
            -
             *top level JSON elements in a stream, | 
| 246 | 
            -
             *  | 
| 247 | 
            -
             *references
         | 
| 242 | 
            +
             * - *:indent* [_Fixnum_|_String_|_nil_] number of spaces to indent each element
         | 
| 243 | 
            +
             *   in an JSON document, zero or nil is no newline between JSON elements,
         | 
| 244 | 
            +
             *   negative indicates no newline between top level JSON elements in a stream,
         | 
| 245 | 
            +
             *   a String indicates the string should be used for indentation
         | 
| 246 | 
            +
             * - *:circular* [_Boolean_|_nil_] support circular references while dumping as
         | 
| 247 | 
            +
             *   well as shared references
         | 
| 248 248 | 
             
             * - *:auto_define* [_Boolean_|_nil_] automatically define classes if they do not exist
         | 
| 249 249 | 
             
             * - *:symbol_keys* [_Boolean_|_nil_] use symbols instead of strings for hash keys
         | 
| 250 | 
            -
             * - *:escape_mode* [_:newline_|_:json_|_:slash_|_:xss_safe_|_:ascii_|_:unicode_xss_|_nil_] | 
| 251 | 
            -
             *characters to escape
         | 
| 252 | 
            -
             * - *:class_cache* [_Boolean_|_nil_] cache classes for faster parsing (if dynamically | 
| 253 | 
            -
             *classes or reloading classes then don't use this)
         | 
| 254 | 
            -
             * - *:mode* [_:object_|_:strict_|_:compat_|_:null_|_:custom_|_:rails_|_:wab_] load and | 
| 255 | 
            -
             *to use for JSON
         | 
| 250 | 
            +
             * - *:escape_mode* [_:newline_|_:json_|_:slash_|_:xss_safe_|_:ascii_|_:unicode_xss_|_nil_]
         | 
| 251 | 
            +
             *   determines the characters to escape
         | 
| 252 | 
            +
             * - *:class_cache* [_Boolean_|_nil_] cache classes for faster parsing (if dynamically
         | 
| 253 | 
            +
             *   modifying classes or reloading classes then don't use this)
         | 
| 254 | 
            +
             * - *:mode* [_:object_|_:strict_|_:compat_|_:null_|_:custom_|_:rails_|_:wab_] load and
         | 
| 255 | 
            +
             *   dump modes to use for JSON
         | 
| 256 256 | 
             
             * - *:time_format* [_:unix_|_:unix_zone_|_:xmlschema_|_:ruby_] time format when dumping
         | 
| 257 | 
            -
             * - *:bigdecimal_as_decimal* [_Boolean_|_nil_] dump BigDecimal as a decimal number or | 
| 258 | 
            -
             * | 
| 259 | 
            -
             * | 
| 260 | 
            -
             * | 
| 261 | 
            -
             *  | 
| 262 | 
            -
             * | 
| 263 | 
            -
             * - *: | 
| 264 | 
            -
             * | 
| 265 | 
            -
             * - *: | 
| 266 | 
            -
             * | 
| 267 | 
            -
             * - *: | 
| 268 | 
            -
             * | 
| 269 | 
            -
             * - *: | 
| 270 | 
            -
             * | 
| 271 | 
            -
             * - *: | 
| 272 | 
            -
             *  | 
| 257 | 
            +
             * - *:bigdecimal_as_decimal* [_Boolean_|_nil_] dump BigDecimal as a decimal number or
         | 
| 258 | 
            +
             *   as a String
         | 
| 259 | 
            +
             * - *:bigdecimal_load* [_:bigdecimal_|_:float_|_:auto_|_:fast_|_:ruby_] load decimals
         | 
| 260 | 
            +
             *   as BigDecimal instead of as a Float. :auto pick the most precise for the number
         | 
| 261 | 
            +
             *   of digits. :float should be the same as ruby. :fast may require rounding but is
         | 
| 262 | 
            +
             *   must faster.
         | 
| 263 | 
            +
             * - *:compat_bigdecimal* [_true_|_false_] load decimals as BigDecimal instead of as
         | 
| 264 | 
            +
             *   a Float when in compat or rails mode.
         | 
| 265 | 
            +
             * - *:create_id* [_String_|_nil_] create id for json compatible object encoding,
         | 
| 266 | 
            +
             *   default is 'json_class'
         | 
| 267 | 
            +
             * - *:create_additions* [_Boolean_|_nil_] if true allow creation of instances using
         | 
| 268 | 
            +
             *   create_id on load.
         | 
| 269 | 
            +
             * - *:second_precision* [_Fixnum_|_nil_] number of digits after the decimal when
         | 
| 270 | 
            +
             *   dumping the seconds portion of time
         | 
| 271 | 
            +
             * - *:float_precision* [_Fixnum_|_nil_] number of digits of precision when dumping
         | 
| 272 | 
            +
             *   floats, 0 indicates use Ruby
         | 
| 273 | 
            +
             * - *:float_format* [_String_] the C printf format string for printing floats.
         | 
| 274 | 
            +
             *   Default follows the float_precision and will be changed if float_precision is
         | 
| 275 | 
            +
             *   changed. The string can be no more than 6 bytes.
         | 
| 273 276 | 
             
             * - *:use_to_json* [_Boolean_|_nil_] call to_json() methods on dump, default is false
         | 
| 274 277 | 
             
             * - *:use_as_json* [_Boolean_|_nil_] call as_json() methods on dump, default is false
         | 
| 275 278 | 
             
             * - *:use_raw_json* [_Boolean_|_nil_] call raw_json() methods on dump, default is false
         | 
| 276 | 
            -
             * - *:nilnil* [_Boolean_|_nil_] if true a nil input to load will return nil and | 
| 277 | 
            -
             *Exception
         | 
| 279 | 
            +
             * - *:nilnil* [_Boolean_|_nil_] if true a nil input to load will return nil and
         | 
| 280 | 
            +
             *   not raise an Exception
         | 
| 278 281 | 
             
             * - *:empty_string* [_Boolean_|_nil_] if true an empty input will not raise an Exception
         | 
| 279 282 | 
             
             * - *:allow_gc* [_Boolean_|_nil_] allow or prohibit GC during parsing, default is true (allow)
         | 
| 280 | 
            -
             * - *:quirks_mode* [_true,_|_false_|_nil_] Allow single JSON values instead of | 
| 281 | 
            -
             *is true (allow)
         | 
| 282 | 
            -
             * - *:allow_invalid_unicode* [_true,_|_false_|_nil_] Allow invalid unicode, | 
| 283 | 
            -
             *allow)
         | 
| 284 | 
            -
             * - *:allow_nan* [_true,_|_false_|_nil_] Allow Nan, Infinity, and -Infinity to | 
| 285 | 
            -
             *is true (allow)
         | 
| 286 | 
            -
             * - *:indent_str* [_String_|_nil_] String to use for indentation, overriding the | 
| 287 | 
            -
             *not nil
         | 
| 288 | 
            -
             * - *:space* [_String_|_nil_] String to use for the space after the colon in JSON | 
| 289 | 
            -
             * | 
| 283 | 
            +
             * - *:quirks_mode* [_true,_|_false_|_nil_] Allow single JSON values instead of
         | 
| 284 | 
            +
             *   documents, default is true (allow)
         | 
| 285 | 
            +
             * - *:allow_invalid_unicode* [_true,_|_false_|_nil_] Allow invalid unicode,
         | 
| 286 | 
            +
             *   default is false (don't allow)
         | 
| 287 | 
            +
             * - *:allow_nan* [_true,_|_false_|_nil_] Allow Nan, Infinity, and -Infinity to
         | 
| 288 | 
            +
             *   be parsed, default is true (allow)
         | 
| 289 | 
            +
             * - *:indent_str* [_String_|_nil_] String to use for indentation, overriding the
         | 
| 290 | 
            +
             *   indent option is not nil
         | 
| 291 | 
            +
             * - *:space* [_String_|_nil_] String to use for the space after the colon in JSON
         | 
| 292 | 
            +
             *   object fields
         | 
| 293 | 
            +
             * - *:space_before* [_String_|_nil_] String to use before the colon separator in
         | 
| 294 | 
            +
             *   JSON object fields
         | 
| 290 295 | 
             
             * - *:object_nl* [_String_|_nil_] String to use after a JSON object field value
         | 
| 291 296 | 
             
             * - *:array_nl* [_String_|_nil_] String to use after a JSON array value
         | 
| 292 | 
            -
             * - *:nan* [_:null_|_:huge_|_:word_|_:raise_|_:auto_] how to dump Infinity and | 
| 293 | 
            -
             *null, :huge places a huge number, :word places Infinity | 
| 294 | 
            -
             *uses default for each mode.
         | 
| 295 | 
            -
             * - *:hash_class* [_Class_|_nil_] Class to use instead of Hash on load, | 
| 296 | 
            -
             *used
         | 
| 297 | 
            +
             * - *:nan* [_:null_|_:huge_|_:word_|_:raise_|_:auto_] how to dump Infinity and
         | 
| 298 | 
            +
             *   NaN. :null places a null, :huge places a huge number, :word places Infinity
         | 
| 299 | 
            +
             *   or NaN, :raise raises and exception, :auto uses default for each mode.
         | 
| 300 | 
            +
             * - *:hash_class* [_Class_|_nil_] Class to use instead of Hash on load,
         | 
| 301 | 
            +
             *   :object_class can also be used
         | 
| 297 302 | 
             
             * - *:array_class* [_Class_|_nil_] Class to use instead of Array on load
         | 
| 298 | 
            -
             * - *:omit_nil* [_true_|_false_] if true Hash and Object attributes with nil | 
| 299 | 
            -
             *  | 
| 303 | 
            +
             * - *:omit_nil* [_true_|_false_] if true Hash and Object attributes with nil
         | 
| 304 | 
            +
             *   values are omitted
         | 
| 305 | 
            +
             * - *:omit_null_byte* [_true_|_false_] if true null bytes in strings will be
         | 
| 306 | 
            +
             *   omitted when dumping
         | 
| 300 307 | 
             
             * - *:ignore* [_nil_|_Array_] either nil or an Array of classes to ignore when dumping
         | 
| 301 | 
            -
             * - *:ignore_under* [_Boolean_] if true then attributes that start with _ are | 
| 302 | 
            -
             *object or custom mode.
         | 
| 308 | 
            +
             * - *:ignore_under* [_Boolean_] if true then attributes that start with _ are
         | 
| 309 | 
            +
             *   ignored when dumping in object or custom mode.
         | 
| 303 310 | 
             
             * - *:cache_keys* [_Boolean_] if true then hash keys are cached if less than 35 bytes.
         | 
| 304 | 
            -
             * - *:cache_str* [_Fixnum_] maximum string value length to cache (strings less | 
| 311 | 
            +
             * - *:cache_str* [_Fixnum_] maximum string value length to cache (strings less
         | 
| 312 | 
            +
             *   than this are cached)
         | 
| 305 313 | 
             
             * - *:integer_range* [_Range_] Dump integers outside range as strings.
         | 
| 306 | 
            -
             * - *:trace* [_true,_|_false_] Trace all load and dump calls, default is false | 
| 307 | 
            -
             *  | 
| 308 | 
            -
             * | 
| 314 | 
            +
             * - *:trace* [_true,_|_false_] Trace all load and dump calls, default is false
         | 
| 315 | 
            +
             *   (trace is off)
         | 
| 316 | 
            +
             * - *:safe* [_true,_|_false_] Safe mimic breaks JSON mimic to be safer, default
         | 
| 317 | 
            +
             *   is false (safe is off)
         | 
| 309 318 | 
             
             *
         | 
| 310 319 | 
             
             * Return [_Hash_] all current option settings.
         | 
| 311 320 | 
             
             */
         | 
| @@ -490,70 +499,67 @@ static VALUE get_def_opts(VALUE self) { | |
| 490 499 | 
             
             *
         | 
| 491 500 | 
             
             * Sets the default options for load and dump.
         | 
| 492 501 | 
             
             * - *opts* [_Hash_] options to change
         | 
| 493 | 
            -
             *   - *:indent* [_Fixnum_|_String_|_nil_] number of spaces to indent each element | 
| 494 | 
            -
             *document or the String to use for indentation.
         | 
| 502 | 
            +
             *   - *:indent* [_Fixnum_|_String_|_nil_] number of spaces to indent each element
         | 
| 503 | 
            +
             *     in a JSON document or the String to use for indentation.
         | 
| 495 504 | 
             
             *   - :circular [_Boolean_|_nil_] support circular references while dumping.
         | 
| 496 505 | 
             
             *   - *:auto_define* [_Boolean_|_nil_] automatically define classes if they do not exist.
         | 
| 497 506 | 
             
             *   - *:symbol_keys* [_Boolean_|_nil_] convert hash keys to symbols.
         | 
| 498 507 | 
             
             *   - *:class_cache* [_Boolean_|_nil_] cache classes for faster parsing.
         | 
| 499 | 
            -
             *   - *:escape* [_:newline_|_:json_|_:xss_safe_|_:ascii_|_unicode_xss_|_nil_] | 
| 500 | 
            -
             *high-bit characters as escaped sequences if :ascii, :json | 
| 501 | 
            -
              | 
| 502 | 
            -
             * | 
| 503 | 
            -
             * | 
| 504 | 
            -
             * | 
| 505 | 
            -
             * | 
| 506 | 
            -
             * | 
| 507 | 
            -
             * | 
| 508 | 
            -
             * | 
| 509 | 
            -
             * | 
| 510 | 
            -
             * | 
| 511 | 
            -
             * | 
| 512 | 
            -
             * | 
| 513 | 
            -
             *Object | 
| 514 | 
            -
             * | 
| 515 | 
            -
             * | 
| 516 | 
            -
             * | 
| 517 | 
            -
             * | 
| 518 | 
            -
             * | 
| 519 | 
            -
             * | 
| 520 | 
            -
             * | 
| 508 | 
            +
             *   - *:escape* [_:newline_|_:json_|_:xss_safe_|_:ascii_|_unicode_xss_|_nil_]
         | 
| 509 | 
            +
             *     mode encodes all high-bit characters as escaped sequences if :ascii, :json
         | 
| 510 | 
            +
             *     is standand UTF-8 JSON encoding, :newline is the same as :json but newlines
         | 
| 511 | 
            +
             *     are not escaped, :unicode_xss allows unicode but escapes &, <, and >, and
         | 
| 512 | 
            +
             *     any \u20xx characters along with some others, and :xss_safe escapes &, <,
         | 
| 513 | 
            +
             *     and >, and some others.
         | 
| 514 | 
            +
             *   - *:bigdecimal_as_decimal* [_Boolean_|_nil_] dump BigDecimal as a decimal
         | 
| 515 | 
            +
             *     number or as a String.
         | 
| 516 | 
            +
             *   - *:bigdecimal_load* [_:bigdecimal_|_:float_|_:auto_|_nil_] load decimals as
         | 
| 517 | 
            +
             *     BigDecimal instead of as a Float. :auto pick the most precise for the number of digits.
         | 
| 518 | 
            +
             *   - *:compat_bigdecimal* [_true_|_false_] load decimals as BigDecimal instead
         | 
| 519 | 
            +
             *     of as a Float in compat mode.
         | 
| 520 | 
            +
             *   - *:mode* [_:object_|_:strict_|_:compat_|_:null_|_:custom_|_:rails_|_:wab_] load
         | 
| 521 | 
            +
             *     and dump mode to use for JSON :strict raises an exception when a non-supported
         | 
| 522 | 
            +
             *     Object is encountered. :compat attempts to extract variable values from an
         | 
| 523 | 
            +
             *     Object using to_json() or to_hash() then it walks the Object's variables if
         | 
| 524 | 
            +
             *     neither is found. The :object mode ignores to_hash() and to_json() methods
         | 
| 525 | 
            +
             *     and encodes variables using code internal to the Oj gem. The :null mode
         | 
| 526 | 
            +
             *     ignores non-supported Objects and replaces them with a null. The :custom
         | 
| 527 | 
            +
             *     mode honors all dump options. The :rails more mimics rails and Active behavior.
         | 
| 528 | 
            +
             *   - *:time_format* [_:unix_|_:xmlschema_|_:ruby_] time format when dumping in :compat
         | 
| 529 | 
            +
             *     mode :unix decimal number denoting the number of seconds since 1/1/1970,
         | 
| 530 | 
            +
             *     :unix_zone decimal number denoting the number of seconds since 1/1/1970
         | 
| 531 | 
            +
             *     plus the utc_offset in the exponent, :xmlschema date-time format taken
         | 
| 532 | 
            +
             *     from XML Schema as a String, :ruby Time.to_s formatted String.
         | 
| 521 533 | 
             
             *   - *:create_id* [_String_|_nil_] create id for json compatible object encoding
         | 
| 522 | 
            -
             *   - *:create_additions* [_Boolean_|_nil_] if true allow creation of instances using create_id on
         | 
| 523 | 
            -
             * | 
| 524 | 
            -
             * | 
| 525 | 
            -
             * | 
| 526 | 
            -
             * | 
| 527 | 
            -
             * | 
| 528 | 
            -
             *   - *:float_precision* [_Fixnum_|_nil_] number of digits of precision when dumping floats, 0
         | 
| 529 | 
            -
             *indicates use Ruby.
         | 
| 534 | 
            +
             *   - *:create_additions* [_Boolean_|_nil_] if true allow creation of instances using create_id on load.
         | 
| 535 | 
            +
             *   - *:second_precision* [_Fixnum_|_nil_] number of digits after the decimal
         | 
| 536 | 
            +
             *     when dumping the seconds portion of time.
         | 
| 537 | 
            +
             *   - *:float_format* [_String_] the C printf format string for printing floats.
         | 
| 538 | 
            +
             *     Default follows the float_precision and will be changed if float_precision
         | 
| 539 | 
            +
             *     is changed. The string can be no more than 6 bytes.
         | 
| 540 | 
            +
             *   - *:float_precision* [_Fixnum_|_nil_] number of digits of precision when dumping floats, 0 indicates use Ruby.
         | 
| 530 541 | 
             
             *   - *:use_to_json* [_Boolean_|_nil_] call to_json() methods on dump, default is false.
         | 
| 531 542 | 
             
             *   - *:use_as_json* [_Boolean_|_nil_] call as_json() methods on dump, default is false.
         | 
| 532 543 | 
             
             *   - *:use_to_hash* [_Boolean_|_nil_] call to_hash() methods on dump, default is false.
         | 
| 533 544 | 
             
             *   - *:use_raw_json* [_Boolean_|_nil_] call raw_json() methods on dump, default is false.
         | 
| 534 | 
            -
             *   - *:nilnil* [_Boolean_|_nil_] if true a nil input to load will return nil and not raise an
         | 
| 535 | 
            -
             *Exception.
         | 
| 545 | 
            +
             *   - *:nilnil* [_Boolean_|_nil_] if true a nil input to load will return nil and not raise an Exception.
         | 
| 536 546 | 
             
             *   - *:allow_gc* [_Boolean_|_nil_] allow or prohibit GC during parsing, default is true (allow).
         | 
| 537 | 
            -
             *   - *:quirks_mode* [_Boolean_|_nil_] allow single JSON values instead of documents, default is
         | 
| 538 | 
            -
             * | 
| 539 | 
            -
             *   - *:allow_invalid_unicode* [_Boolean_|_nil_] allow invalid unicode, default is false (don't
         | 
| 540 | 
            -
             *allow).
         | 
| 547 | 
            +
             *   - *:quirks_mode* [_Boolean_|_nil_] allow single JSON values instead of documents, default is true (allow).
         | 
| 548 | 
            +
             *   - *:allow_invalid_unicode* [_Boolean_|_nil_] allow invalid unicode, default is false (don't allow).
         | 
| 541 549 | 
             
             *   - *:allow_nan* [_Boolean_|_nil_] allow Nan, Infinity, and -Infinity, default is true (allow).
         | 
| 542 550 | 
             
             *   - *:space* [_String_|_nil_] String to use for the space after the colon in JSON object fields.
         | 
| 543 | 
            -
             *   - *:space_before* [_String_|_nil_] String to use before the colon separator in JSON object
         | 
| 544 | 
            -
             *fields.
         | 
| 551 | 
            +
             *   - *:space_before* [_String_|_nil_] String to use before the colon separator in JSON object fields.
         | 
| 545 552 | 
             
             *   - *:object_nl* [_String_|_nil_] String to use after a JSON object field value.
         | 
| 546 553 | 
             
             *   - *:array_nl* [_String_|_nil_] String to use after a JSON array value
         | 
| 547 | 
            -
             *   - *:nan* [_:null_|_:huge_|_:word_|_:raise_] how to dump Infinity and NaN in null, | 
| 548 | 
            -
             *compat mode. :null places a null, :huge places a huge number, :word | 
| 549 | 
            -
             *raises and exception, :auto uses default for each mode.
         | 
| 550 | 
            -
             *   - *:hash_class* [_Class_|_nil_] Class to use instead of Hash on load, :object_class can also be
         | 
| 551 | 
            -
             *used.
         | 
| 554 | 
            +
             *   - *:nan* [_:null_|_:huge_|_:word_|_:raise_] how to dump Infinity and NaN in null,
         | 
| 555 | 
            +
             *     strict, and compat mode. :null places a null, :huge places a huge number, :word
         | 
| 556 | 
            +
             *     places Infinity or NaN, :raise raises and exception, :auto uses default for each mode.
         | 
| 557 | 
            +
             *   - *:hash_class* [_Class_|_nil_] Class to use instead of Hash on load, :object_class can also be used.
         | 
| 552 558 | 
             
             *   - *:array_class* [_Class_|_nil_] Class to use instead of Array on load.
         | 
| 553 559 | 
             
             *   - *:omit_nil* [_true_|_false_] if true Hash and Object attributes with nil values are omitted.
         | 
| 554 560 | 
             
             *   - *:ignore* [_nil_|Array] either nil or an Array of classes to ignore when dumping
         | 
| 555 | 
            -
             *   - *:ignore_under* [_Boolean_] if true then attributes that start with _ are | 
| 556 | 
            -
             *dumping in object or custom mode.
         | 
| 561 | 
            +
             *   - *:ignore_under* [_Boolean_] if true then attributes that start with _ are
         | 
| 562 | 
            +
             *     ignored when dumping in object or custom mode.
         | 
| 557 563 | 
             
             *   - *:cache_keys* [_Boolean_] if true then hash keys are cached
         | 
| 558 564 | 
             
             *   - *:cache_str* [_Fixnum_] maximum string value length to cache (strings less than this are cached)
         | 
| 559 565 | 
             
             *   - *:integer_range* [_Range_] Dump integers outside range as strings.
         | 
| @@ -1329,18 +1335,16 @@ static VALUE dump(int argc, VALUE *argv, VALUE self) { | |
| 1329 1335 | 
             
             * will be called. The mode is set to :compat.
         | 
| 1330 1336 | 
             
             * - *obj* [_Object_] Object to serialize as an JSON document String
         | 
| 1331 1337 | 
             
             * - *options* [_Hash_]
         | 
| 1332 | 
            -
             *   - *:max_nesting* [_Fixnum_|_boolean_] It true nesting is limited to 100. | 
| 1333 | 
            -
             * is set to the provided value. The option to detect | 
| 1334 | 
            -
             * compatible with the json gem., | 
| 1335 | 
            -
             * | 
| 1336 | 
            -
             *  | 
| 1337 | 
            -
             * | 
| 1338 | 
            -
             * (allow).
         | 
| 1339 | 
            -
             *   - *:indent* [_String_|_nil_] String to use for indentation, overriding the indent option if not
         | 
| 1340 | 
            -
             * nil.
         | 
| 1338 | 
            +
             *   - *:max_nesting* [_Fixnum_|_boolean_] It true nesting is limited to 100.
         | 
| 1339 | 
            +
             *     If a Fixnum nesting is set to the provided value. The option to detect
         | 
| 1340 | 
            +
             *     circular references is available but is not compatible with the json gem.,
         | 
| 1341 | 
            +
             *     default is false or unlimited.
         | 
| 1342 | 
            +
             *   - *:allow_nan* [_boolean_] If true non JSON compliant words such as Nan and
         | 
| 1343 | 
            +
             *     Infinity will be used as appropriate, default is true.
         | 
| 1344 | 
            +
             *   - *:quirks_mode* [_boolean_] Allow single JSON values instead of documents, default is true (allow).
         | 
| 1345 | 
            +
             *   - *:indent* [_String_|_nil_] String to use for indentation, overriding the indent option if not nil.
         | 
| 1341 1346 | 
             
             *   - *:space* [_String_|_nil_] String to use for the space after the colon in JSON object fields.
         | 
| 1342 | 
            -
             *   - *:space_before* [_String_|_nil_] String to use before the colon separator in JSON object
         | 
| 1343 | 
            -
             * fields.
         | 
| 1347 | 
            +
             *   - *:space_before* [_String_|_nil_] String to use before the colon separator in JSON object fields.
         | 
| 1344 1348 | 
             
             *   - *:object_nl* [_String_|_nil_] String to use after a JSON object field value.
         | 
| 1345 1349 | 
             
             *   - *:array_nl* [_String_|_nil_] String to use after a JSON array value.
         | 
| 1346 1350 | 
             
             *   - *:trace* [_Boolean_] If true trace is turned on.
         | 
| @@ -1435,10 +1439,10 @@ static VALUE to_stream(int argc, VALUE *argv, VALUE self) { | |
| 1435 1439 | 
             
             *
         | 
| 1436 1440 | 
             
             * - *clas* [_Class__|_Module_] Class or Module to be made special
         | 
| 1437 1441 | 
             
             * - *create_object* [_Object_]  object to call the create method on
         | 
| 1438 | 
            -
             * - *create_method* [_Symbol_] method on the clas that will create a new instance | 
| 1439 | 
            -
             * given all the member values in the order specified.
         | 
| 1440 | 
            -
             * - *members* [_Symbol__|_String_] methods used to get the member values from | 
| 1441 | 
            -
             * clas.
         | 
| 1442 | 
            +
             * - *create_method* [_Symbol_] method on the clas that will create a new instance
         | 
| 1443 | 
            +
             *   of the clas when given all the member values in the order specified.
         | 
| 1444 | 
            +
             * - *members* [_Symbol__|_String_] methods used to get the member values from
         | 
| 1445 | 
            +
             *   instances of the clas.
         | 
| 1442 1446 | 
             
             */
         | 
| 1443 1447 | 
             
            static VALUE register_odd(int argc, VALUE *argv, VALUE self) {
         | 
| 1444 1448 | 
             
                if (3 > argc) {
         | 
| @@ -1471,10 +1475,10 @@ static VALUE register_odd(int argc, VALUE *argv, VALUE self) { | |
| 1471 1475 | 
             
             *
         | 
| 1472 1476 | 
             
             * - *clas* [_Class_|_Module_] Class or Module to be made special
         | 
| 1473 1477 | 
             
             * - *create_object* [_Object_] object to call the create method on
         | 
| 1474 | 
            -
             * - *create_method* [_Symbol_] method on the clas that will create a new instance | 
| 1475 | 
            -
             *given all the member values in the order specified.
         | 
| 1476 | 
            -
             * - *dump_method* [_Symbol_|_String_] method to call on the object being | 
| 1477 | 
            -
             *raw JSON.
         | 
| 1478 | 
            +
             * - *create_method* [_Symbol_] method on the clas that will create a new instance
         | 
| 1479 | 
            +
             *   of the clas when given all the member values in the order specified.
         | 
| 1480 | 
            +
             * - *dump_method* [_Symbol_|_String_] method to call on the object being
         | 
| 1481 | 
            +
             *   serialized to generate the raw JSON.
         | 
| 1478 1482 | 
             
             */
         | 
| 1479 1483 | 
             
            static VALUE register_odd_raw(int argc, VALUE *argv, VALUE self) {
         | 
| 1480 1484 | 
             
                if (3 > argc) {
         | 
| @@ -1700,8 +1704,8 @@ extern VALUE oj_define_mimic_json(int argc, VALUE *argv, VALUE self); | |
| 1700 1704 | 
             
             *   - *:space_before* [_String_] String placed before a : delimiter
         | 
| 1701 1705 | 
             
             *   - *:object_nl* [_String_] String placed after a JSON object
         | 
| 1702 1706 | 
             
             *   - *:array_nl* [_String_] String placed after a JSON array
         | 
| 1703 | 
            -
             *   - *:ascii_only* [_Boolean_] if not nil or false then use only ascii characters | 
| 1704 | 
            -
             * Note JSON.generate does support this even if it is not documented.
         | 
| 1707 | 
            +
             *   - *:ascii_only* [_Boolean_] if not nil or false then use only ascii characters
         | 
| 1708 | 
            +
             *     in the output. Note JSON.generate does support this even if it is not documented.
         | 
| 1705 1709 | 
             
             *
         | 
| 1706 1710 | 
             
             * Returns [_String_]generated JSON.
         | 
| 1707 1711 | 
             
             */
         | 
| @@ -1758,8 +1762,8 @@ static VALUE mem_report(VALUE self) { | |
| 1758 1762 | 
             
             * global and options to methods allow additional behavior modifications. The
         | 
| 1759 1763 | 
             
             * modes are:
         | 
| 1760 1764 | 
             
             *
         | 
| 1761 | 
            -
             * - *:strict* mode will only allow the 7 basic JSON types to be serialized. | 
| 1762 | 
            -
             *   will raise an Exception.
         | 
| 1765 | 
            +
             * - *:strict* mode will only allow the 7 basic JSON types to be serialized.
         | 
| 1766 | 
            +
             *   Any other Object will raise an Exception.
         | 
| 1763 1767 | 
             
             *
         | 
| 1764 1768 | 
             
             * - *:null* mode is similar to the :strict mode except any Object that is not
         | 
| 1765 1769 | 
             
             *   one of the JSON base types is replaced by a JSON null.
         | 
| @@ -1843,10 +1847,10 @@ void Init_oj(void) { | |
| 1843 1847 | 
             
                oj_array_end_id    = rb_intern("array_end");
         | 
| 1844 1848 | 
             
                oj_array_start_id  = rb_intern("array_start");
         | 
| 1845 1849 | 
             
                oj_as_json_id      = rb_intern("as_json");
         | 
| 1846 | 
            -
                oj_at_id           = rb_intern("at");
         | 
| 1847 1850 | 
             
                oj_begin_id        = rb_intern("begin");
         | 
| 1848 1851 | 
             
                oj_bigdecimal_id   = rb_intern("BigDecimal");
         | 
| 1849 1852 | 
             
                oj_end_id          = rb_intern("end");
         | 
| 1853 | 
            +
                oj_eofq_id         = rb_intern("eof?");
         | 
| 1850 1854 | 
             
                oj_error_id        = rb_intern("error");
         | 
| 1851 1855 | 
             
                oj_exclude_end_id  = rb_intern("exclude_end?");
         | 
| 1852 1856 | 
             
                oj_file_id         = rb_intern("file?");
         | 
| @@ -1861,6 +1865,7 @@ void Init_oj(void) { | |
| 1861 1865 | 
             
                oj_length_id       = rb_intern("length");
         | 
| 1862 1866 | 
             
                oj_new_id          = rb_intern("new");
         | 
| 1863 1867 | 
             
                oj_parse_id        = rb_intern("parse");
         | 
| 1868 | 
            +
                oj_plus_id         = rb_intern("+");
         | 
| 1864 1869 | 
             
                oj_pos_id          = rb_intern("pos");
         | 
| 1865 1870 | 
             
                oj_raw_json_id     = rb_intern("raw_json");
         | 
| 1866 1871 | 
             
                oj_read_id         = rb_intern("read");
         | 
| @@ -1993,14 +1998,10 @@ void Init_oj(void) { | |
| 1993 1998 | 
             
                rb_gc_register_address(&oj_decimal_class_sym);
         | 
| 1994 1999 | 
             
                oj_hash_class_sym = ID2SYM(rb_intern("hash_class"));
         | 
| 1995 2000 | 
             
                rb_gc_register_address(&oj_hash_class_sym);
         | 
| 1996 | 
            -
                oj_in_sym = ID2SYM(rb_intern("in"));
         | 
| 1997 | 
            -
                rb_gc_register_address(&oj_in_sym);
         | 
| 1998 2001 | 
             
                oj_indent_sym = ID2SYM(rb_intern("indent"));
         | 
| 1999 2002 | 
             
                rb_gc_register_address(&oj_indent_sym);
         | 
| 2000 2003 | 
             
                oj_max_nesting_sym = ID2SYM(rb_intern("max_nesting"));
         | 
| 2001 2004 | 
             
                rb_gc_register_address(&oj_max_nesting_sym);
         | 
| 2002 | 
            -
                oj_nanosecond_sym = ID2SYM(rb_intern("nanosecond"));
         | 
| 2003 | 
            -
                rb_gc_register_address(&oj_nanosecond_sym);
         | 
| 2004 2005 | 
             
                oj_object_class_sym = ID2SYM(rb_intern("object_class"));
         | 
| 2005 2006 | 
             
                rb_gc_register_address(&oj_object_class_sym);
         | 
| 2006 2007 | 
             
                oj_object_nl_sym = ID2SYM(rb_intern("object_nl"));
         | 
    
        data/ext/oj/oj.h
    CHANGED
    
    | @@ -262,6 +262,8 @@ extern void  oj_dump_leaf_to_json(Leaf leaf, Options copts, Out out); | |
| 262 262 | 
             
            extern void  oj_write_leaf_to_file(Leaf leaf, const char *path, Options copts);
         | 
| 263 263 | 
             
            extern char *oj_longlong_to_string(long long num, bool negative, char *buf);
         | 
| 264 264 |  | 
| 265 | 
            +
            extern StrWriter oj_str_writer_unwrap(VALUE writer);
         | 
| 266 | 
            +
             | 
| 265 267 | 
             
            extern void oj_str_writer_push_key(StrWriter sw, const char *key);
         | 
| 266 268 | 
             
            extern void oj_str_writer_push_object(StrWriter sw, const char *key);
         | 
| 267 269 | 
             
            extern void oj_str_writer_push_array(StrWriter sw, const char *key);
         | 
| @@ -311,9 +313,7 @@ extern VALUE oj_ascii_only_sym; | |
| 311 313 | 
             
            extern VALUE oj_create_additions_sym;
         | 
| 312 314 | 
             
            extern VALUE oj_decimal_class_sym;
         | 
| 313 315 | 
             
            extern VALUE oj_hash_class_sym;
         | 
| 314 | 
            -
            extern VALUE oj_in_sym;
         | 
| 315 316 | 
             
            extern VALUE oj_indent_sym;
         | 
| 316 | 
            -
            extern VALUE oj_nanosecond_sym;
         | 
| 317 317 | 
             
            extern VALUE oj_max_nesting_sym;
         | 
| 318 318 | 
             
            extern VALUE oj_object_class_sym;
         | 
| 319 319 | 
             
            extern VALUE oj_object_nl_sym;
         | 
| @@ -331,10 +331,10 @@ extern ID oj_array_append_id; | |
| 331 331 | 
             
            extern ID oj_array_end_id;
         | 
| 332 332 | 
             
            extern ID oj_array_start_id;
         | 
| 333 333 | 
             
            extern ID oj_as_json_id;
         | 
| 334 | 
            -
            extern ID oj_at_id;
         | 
| 335 334 | 
             
            extern ID oj_begin_id;
         | 
| 336 335 | 
             
            extern ID oj_bigdecimal_id;
         | 
| 337 336 | 
             
            extern ID oj_end_id;
         | 
| 337 | 
            +
            extern ID oj_eofq_id;
         | 
| 338 338 | 
             
            extern ID oj_error_id;
         | 
| 339 339 | 
             
            extern ID oj_exclude_end_id;
         | 
| 340 340 | 
             
            extern ID oj_file_id;
         | 
| @@ -349,6 +349,7 @@ extern ID oj_json_create_id; | |
| 349 349 | 
             
            extern ID oj_length_id;
         | 
| 350 350 | 
             
            extern ID oj_new_id;
         | 
| 351 351 | 
             
            extern ID oj_parse_id;
         | 
| 352 | 
            +
            extern ID oj_plus_id;
         | 
| 352 353 | 
             
            extern ID oj_pos_id;
         | 
| 353 354 | 
             
            extern ID oj_read_id;
         | 
| 354 355 | 
             
            extern ID oj_readpartial_id;
         |