oj 3.3.5 → 3.3.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c07155b4f125fbaf35a6569b293d440aa44f7331
4
- data.tar.gz: 6250fe522da7b0bde33f6462dcee5881f79a2051
3
+ metadata.gz: deb93f1a098c0d7ed3cf11105c2b76ea98ab692a
4
+ data.tar.gz: f7cf3c8f48c0d4329a01771837f13d09103bf37c
5
5
  SHA512:
6
- metadata.gz: 8fb8687b5a703d12954859ce85967b494d2913d9bfc681fc93496327878c02c6b1bf0aec58bbd4af0c3b782523dca7e648636b6293f487ef7e829a91dc2069ee
7
- data.tar.gz: c0a0e8f5d5b728627b0a1658e8bef7ecd130e7f0494ae2c0559789ead19eab11a0b8e9818c0867e4b970a698055619b13f1873bdbf47a4eeddf1ef7d32c30694
6
+ metadata.gz: d0550705f9f2147b3e9ab45d6e96671050ec0b8f5b42338e9e8e277ea305e68d67407fdeffae673b330d827da657218d5c1a8e44fe4dbb889fd0922a88314c58
7
+ data.tar.gz: 9b6337fc9ab58ff49868f069275cac7a8f427ecde5a40a31de78af97494c8aefef7cb23a5765f05c3be5cfcc37fa6e44b10af1d8960a8f4a94d3b4f7b4fe56b5
@@ -771,11 +771,11 @@ dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
771
771
  #endif
772
772
 
773
773
  #ifdef RSTRUCT_LEN
774
- #if UNIFY_FIXNUM_AND_BIGNUM
774
+ #if RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
775
775
  cnt = (int)NUM2LONG(RSTRUCT_LEN(obj));
776
- #else // UNIFY_FIXNUM_AND_INTEGER
776
+ #else // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
777
777
  cnt = (int)RSTRUCT_LEN(obj);
778
- #endif // UNIFY_FIXNUM_AND_INTEGER
778
+ #endif // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
779
779
  #else
780
780
  // This is a bit risky as a struct in C ruby is not the same as a Struct
781
781
  // class in interpreted Ruby so length() may not be defined.
@@ -793,11 +793,11 @@ dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
793
793
  raise_json_err("Only named structs are supported.", "JSONError");
794
794
  }
795
795
  #ifdef RSTRUCT_LEN
796
- #if UNIFY_FIXNUM_AND_BIGNUM
796
+ #if RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
797
797
  cnt = (int)NUM2LONG(RSTRUCT_LEN(obj));
798
- #else // UNIFY_FIXNUM_AND_INTEGER
798
+ #else // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
799
799
  cnt = (int)RSTRUCT_LEN(obj);
800
- #endif // UNIFY_FIXNUM_AND_INTEGER
800
+ #endif // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
801
801
  #else
802
802
  // This is a bit risky as a struct in C ruby is not the same as a Struct
803
803
  // class in interpreted Ruby so length() may not be defined.
@@ -727,11 +727,11 @@ dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
727
727
  {
728
728
  VALUE v;
729
729
  int cnt;
730
- #if UNIFY_FIXNUM_AND_BIGNUM
730
+ #if RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
731
731
  cnt = (int)NUM2LONG(RSTRUCT_LEN(obj));
732
- #else // UNIFY_FIXNUM_AND_INTEGER
732
+ #else // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
733
733
  cnt = (int)RSTRUCT_LEN(obj);
734
- #endif // UNIFY_FIXNUM_AND_INTEGER
734
+ #endif // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
735
735
 
736
736
  for (i = 0; i < cnt; i++) {
737
737
  v = RSTRUCT_GET(obj, i);
@@ -32,12 +32,11 @@ dflags = {
32
32
  'IS_WINDOWS' => is_windows ? 1 : 0,
33
33
  'USE_PTHREAD_MUTEX' => is_windows ? 0 : 1,
34
34
  'USE_RB_MUTEX' => (is_windows && !('1' == version[0] && '8' == version[1])) ? 1 : 0,
35
- 'DATETIME_1_8' => ('ruby' == type && ('1' == version[0] && '8' == version[1])) ? 1 : 0,
36
35
  'NO_TIME_ROUND_PAD' => ('rubinius' == type) ? 1 : 0,
37
36
  'HAS_DATA_OBJECT_WRAP' => ('ruby' == type && '2' == version[0] && '3' <= version[1]) ? 1 : 0,
38
37
  'HAS_METHOD_ARITY' => ('rubinius' == type) ? 0 : 1,
39
38
  'HAS_STRUCT_MEMBERS' => ('rubinius' == type) ? 0 : 1,
40
- 'UNIFY_FIXNUM_AND_BIGNUM' => ('ruby' == type && '2' == version[0] && '4' <= version[1]) ? 1 : 0,
39
+ 'RSTRUCT_LEN_RETURNS_INTEGER_OBJECT' => ('ruby' == type && '2' == version[0] && '4' == version[1] && '1' >= version[2]) ? 1 : 0,
41
40
  }
42
41
  # This is a monster hack to get around issues with 1.9.3-p0 on CentOS 5.4. SO
43
42
  # some reason math.h and string.h contents are not processed. Might be a
@@ -485,11 +485,10 @@ oj_mimic_pretty_generate(int argc, VALUE *argv, VALUE self) {
485
485
  static VALUE
486
486
  mimic_parse_core(int argc, VALUE *argv, VALUE self, bool bang) {
487
487
  struct _ParseInfo pi;
488
+ VALUE ropts;
488
489
  VALUE args[1];
489
490
 
490
- if (argc < 1) {
491
- rb_raise(rb_eArgError, "Wrong number of arguments to parse.");
492
- }
491
+ rb_scan_args(argc, argv, "11", NULL, &ropts);
493
492
  parse_info_init(&pi);
494
493
  oj_set_compat_callbacks(&pi);
495
494
  // TBD
@@ -508,8 +507,7 @@ mimic_parse_core(int argc, VALUE *argv, VALUE self, bool bang) {
508
507
  pi.options.mode = CompatMode;
509
508
  pi.max_depth = 100;
510
509
 
511
- if (2 <= argc && Qnil != argv[1]) {
512
- VALUE ropts = argv[1];
510
+ if (Qnil != ropts) {
513
511
  VALUE v;
514
512
 
515
513
  if (T_HASH != rb_type(ropts)) {
@@ -366,11 +366,11 @@ hat_value(ParseInfo pi, Val parent, const char *key, size_t klen, volatile VALUE
366
366
  parent->val = rb_obj_alloc(sc);
367
367
  // If the JSON array has more entries than the struct class allows, we record an error.
368
368
  #ifdef RSTRUCT_LEN
369
- #if UNIFY_FIXNUM_AND_BIGNUM
369
+ #if RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
370
370
  slen = (int)NUM2LONG(RSTRUCT_LEN(parent->val));
371
- #else // UNIFY_FIXNUM_AND_INTEGER
371
+ #else // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
372
372
  slen = (int)RSTRUCT_LEN(parent->val);
373
- #endif // UNIFY_FIXNUM_AND_INTEGER
373
+ #endif // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
374
374
  #else
375
375
  slen = FIX2INT(rb_funcall2(parent->val, oj_length_id, 0, 0));
376
376
  #endif
@@ -44,9 +44,6 @@ get_datetime_secs(VALUE obj) {
44
44
  long long num = rb_num2ll(rb_funcall(rfrac, numerator_id, 0));
45
45
  long long den = rb_num2ll(rb_funcall(rfrac, denominator_id, 0));
46
46
 
47
- #if DATETIME_1_8
48
- num *= 86400;
49
- #endif
50
47
  num += sec * den;
51
48
 
52
49
  return rb_funcall(rb_cObject, rational_id, 2, rb_ll2inum(num), rb_ll2inum(den));
@@ -149,11 +149,11 @@ dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
149
149
  const char *name;
150
150
 
151
151
  #ifdef RSTRUCT_LEN
152
- #if UNIFY_FIXNUM_AND_BIGNUM
152
+ #if RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
153
153
  cnt = (int)NUM2LONG(RSTRUCT_LEN(obj));
154
- #else // UNIFY_FIXNUM_AND_INTEGER
154
+ #else // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
155
155
  cnt = (int)RSTRUCT_LEN(obj);
156
- #endif // UNIFY_FIXNUM_AND_INTEGER
156
+ #endif // RSTRUCT_LEN_RETURNS_INTEGER_OBJECT
157
157
  #else
158
158
  // This is a bit risky as a struct in C ruby is not the same as a Struct
159
159
  // class in interpreted Ruby so length() may not be defined.
@@ -422,11 +422,11 @@ cstr_to_rstr(const char *str, size_t len) {
422
422
  volatile VALUE v = Qnil;
423
423
 
424
424
  if (30 == len && '-' == str[4] && '-' == str[7] && 'T' == str[10] && ':' == str[13] && ':' == str[16] && '.' == str[19] && 'Z' == str[29]) {
425
- if (Qnil != (v = time_parse(str, len))) {
425
+ if (Qnil != (v = time_parse(str, (int)len))) {
426
426
  return v;
427
427
  }
428
428
  }
429
- if (36 == len && '-' == str[8] && '-' == str[13] && '-' == str[18] && '-' == str[23] && uuid_check(str, len) && Qnil != resolve_wab_uuid_class()) {
429
+ if (36 == len && '-' == str[8] && '-' == str[13] && '-' == str[18] && '-' == str[23] && uuid_check(str, (int)len) && Qnil != resolve_wab_uuid_class()) {
430
430
  return rb_funcall(wab_uuid_clas, oj_new_id, 1, rb_str_new(str, len));
431
431
  }
432
432
  v = rb_str_new(str, len);
@@ -1,23 +1,22 @@
1
1
 
2
2
  module Oj
3
3
 
4
- class Error < StandardError
5
- end # Error
4
+ # Inherit Error class from StandardError.
5
+ Error = Class.new(StandardError)
6
+
7
+ # Following classes inherit from the Error class.
8
+ # -----------------------------------------------
6
9
 
7
10
  # An Exception that is raised as a result of a parse error while parsing a JSON document.
8
- class ParseError < Error
9
- end # ParseError
11
+ ParseError = Class.new(Error)
10
12
 
11
13
  # An Exception that is raised as a result of a path being too deep.
12
- class DepthError < Error
13
- end # DepthError
14
+ DepthError = Class.new(Error)
14
15
 
15
16
  # An Exception that is raised if a file fails to load.
16
- class LoadError < Error
17
- end # LoadError
17
+ LoadError = Class.new(Error)
18
18
 
19
19
  # An Exception that is raised if there is a conflict with mimicing JSON
20
- class MimicError < Error
21
- end # MimicError
20
+ MimicError = Class.new(Error)
22
21
 
23
22
  end # Oj
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.3.5'
4
+ VERSION = '3.3.6'
5
5
  end
@@ -87,3 +87,7 @@ Oj::Rails.set_decoder() method replaces that method with the Oj equivelant.
87
87
  that has already been used. This could occur is a mix of String and Symbols
88
88
  are used as keys or if a other non-String objects such as Numerics are mixed
89
89
  with numbers as Strings.
90
+
91
+ 3. To verify Oj is being used turn on trace and then set the
92
+ `Tracer.display_c_call = true` to see calls to C extensions.
93
+
@@ -6,146 +6,19 @@
6
6
  end
7
7
 
8
8
  require 'oj'
9
- require 'active_support/json'
10
9
 
11
- Oj::Rails.set_encoder
12
- ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false
10
+ S = Struct.new(
11
+ :chunk_seq,
12
+ :youngest,
13
+ :oldest,
14
+ :size
15
+ )
13
16
 
14
- text = [
15
- 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 195, 156, 42, 32, 195, 156, 42, 42,
16
- 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 13,
17
- 10, 240, 159, 147, 183, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 58, 32, 42, 42, 42, 42, 42, 42, 42,
18
- 42, 42, 42, 32, 13, 10, 240, 159, 147, 141, 32, 42, 42, 42, 42, 195, 188, 42, 42, 42, 42, 42, 32,
19
- 13, 10, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128,
20
- 32, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32,
21
- 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32, 226, 160, 128, 32, 226,
22
- 160, 128, 32, 13, 10, 38, 42, 42, 42, 42, 59, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42,
23
- 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 195, 159, 32, 42, 42, 42, 42, 42, 42,
24
- 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42, 32, 42, 42, 42, 32,
25
- 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 38, 42, 42, 42, 42, 59, 32, 45, 32, 42, 42,
26
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 58, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42,
27
- 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 42, 46,
28
- 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 32,
29
- 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 46, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 46, 46, 32,
30
- 226, 152, 186, 32, 13, 10, 226, 149, 148, 226, 149, 144, 198, 184, 204, 181, 204, 161, 211, 156,
31
- 204, 181, 204, 168, 204, 132, 198, 183, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144,
32
- 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149,
33
- 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226,
34
- 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 151,
35
- 32, 13, 10, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 226, 153,
36
- 165, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42,
37
- 42, 33, 32, 13, 10, 226, 149, 154, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226,
38
- 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144,
39
- 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149,
40
- 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 226, 149, 144, 198, 184, 204, 181,
41
- 204, 161, 211, 156, 204, 181, 204, 168, 204, 132, 198, 183, 226, 149, 144, 13, 10, 13, 10, 226, 128,
42
- 162, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 195, 164, 32, 42, 32, 42, 32, 42, 32, 42,
43
- 32, 42, 32, 42, 32, 42, 32, 42, 32, 226, 128, 162, 32, 13, 10, 42, 42, 42, 42, 42, 42, 32, 42, 42,
44
- 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 44, 32, 42, 42, 42,
45
- 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42,
46
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 195, 164, 42,
47
- 42, 42, 42, 46, 32, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42,
48
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32,
49
- 42, 42, 42, 195, 182, 42, 42, 42, 42, 33, 32, 13, 10, 42, 42, 42, 42, 42, 32, 42, 195, 188, 42, 42,
50
- 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42,
51
- 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 195, 164, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42,
52
- 32, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42,
53
- 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42,
54
- 42, 42, 42, 42, 42, 42, 32, 38, 42, 42, 42, 42, 59, 32, 42, 42, 42, 42, 32, 42, 42, 32, 38, 42, 42,
55
- 42, 42, 59, 46, 46, 32, 13, 10, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42,
56
- 42, 32, 42, 42, 42, 42, 42, 58, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42,
57
- 42, 42, 195, 164, 42, 42, 42, 42, 42, 32, 42, 42, 42, 195, 188, 42, 44, 32, 42, 42, 42, 42, 32, 42,
58
- 42, 42, 42, 32, 42, 42, 42, 32, 42, 195, 164, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42,
59
- 42, 42, 195, 182, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
60
- 32, 42, 42, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42,
61
- 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 195, 188, 42, 42, 42, 42, 32,
62
- 42, 42, 42, 42, 42, 42, 42, 46, 13, 10, 40, 33, 41, 32, 42, 42, 32, 42, 42, 42, 42, 32, 195, 188,
63
- 42, 42, 42, 42, 42, 42, 42, 32, 58, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42,
64
- 32, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42,
65
- 32, 45, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42,
66
- 42, 42, 32, 40, 33, 41, 13, 10, 13, 10, 226, 128, 162, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32,
67
- 42, 32, 47, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 47, 32, 42, 32, 42, 32, 42,
68
- 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 226, 128, 162, 32, 13,
69
- 10, 42, 42, 42, 32, 42, 42, 42, 32, 42, 195, 188, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 45,
70
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 33, 32, 42, 42, 42, 32,
71
- 42, 42, 42, 195, 159, 42, 32, 58, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42,
72
- 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42,
73
- 42, 42, 42, 32, 40, 32, 42, 42, 42, 195, 188, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42,
74
- 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42,
75
- 42, 32, 41, 32, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 46, 32,
76
- 13, 10, 13, 10, 226, 128, 162, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 226, 128,
77
- 162, 32, 13, 10, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42,
78
- 42, 42, 42, 42, 42, 42, 46, 46, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42,
79
- 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42,
80
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32,
81
- 42, 195, 182, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 46, 32, 42, 42, 32,
82
- 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42,
83
- 42, 42, 44, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
84
- 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32,
85
- 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 40, 32, 42, 46, 42, 46, 32, 42, 42, 42, 32,
86
- 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 46, 42, 42, 46, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42,
87
- 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 32, 42,
88
- 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42,
89
- 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32,
90
- 41, 32, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32,
91
- 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42,
92
- 42, 42, 32, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
93
- 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 44, 32, 42, 42, 42, 42, 42,
94
- 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 46, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42,
95
- 42, 32, 42, 42, 42, 42, 42, 32, 42, 195, 182, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42,
96
- 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 195, 164, 42, 42, 42, 42, 32, 42, 42, 42, 42,
97
- 42, 42, 46, 46, 32, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32,
98
- 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32,
99
- 42, 42, 42, 42, 42, 42, 42, 32, 45, 32, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42,
100
- 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42,
101
- 32, 58, 45, 41, 13, 10, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42,
102
- 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42,
103
- 42, 42, 42, 42, 32, 42, 42, 42, 42, 44, 32, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42,
104
- 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42,
105
- 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 32, 42,
106
- 42, 42, 32, 42, 195, 164, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42,
107
- 42, 32, 42, 42, 195, 182, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 195, 188, 42, 42,
108
- 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42,
109
- 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42,
110
- 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42,
111
- 46, 32, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 195, 188,
112
- 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32,
113
- 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 46, 32, 13, 10,
114
- 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42,
115
- 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 195, 188, 42, 42, 42,
116
- 42, 42, 32, 42, 42, 42, 42, 33, 32, 13, 10, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42,
117
- 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42,
118
- 32, 42, 195, 164, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42,
119
- 42, 42, 42, 32, 42, 42, 42, 42, 46, 32, 40, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 195,
120
- 188, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42, 32,
121
- 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 195, 159, 32, 42, 42, 42, 32, 42,
122
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 46, 46, 32, 41, 13, 10, 13,
123
- 10, 226, 128, 162, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 47, 32, 42, 32, 42, 32, 42,
124
- 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 47, 32, 42, 32, 42, 32, 42, 32, 195, 164, 32, 42, 32,
125
- 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 226, 128, 162, 32, 13, 10,
126
- 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42,
127
- 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 32, 42, 42, 42,
128
- 32, 42, 195, 164, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42,
129
- 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42,
130
- 42, 42, 195, 164, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 46, 32, 194, 167, 32, 42, 42, 42, 32, 42,
131
- 42, 42, 46, 42, 32, 42, 42, 42, 32, 13, 10, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42,
132
- 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 195, 188, 42, 42, 46, 32, 42, 42, 42,
133
- 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 195, 164, 42,
134
- 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42, 44, 32, 42, 42, 42, 42, 42, 42, 32,
135
- 42, 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 32, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42,
136
- 42, 42, 42, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 42, 42,
137
- 46, 32, 13, 10, 42, 42, 42, 32, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42,
138
- 42, 42, 42, 42, 32, 42, 42, 42, 42, 42, 46, 46, 32, 13, 10, 42, 42, 42, 32, 42, 195, 188, 42, 42,
139
- 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 42, 32, 42, 42, 42, 195, 159, 32, 42, 42, 42, 42,
140
- 32, 42, 42, 42, 42, 42, 42, 42, 42, 33, 32, 58, 45, 41 ]
141
- .pack('c*').force_encoding('UTF-8')
17
+ data = S.new(
18
+ chunk_seq: 666000,
19
+ youngest: nil,
20
+ oldest: nil,
21
+ size: 1
22
+ )
142
23
 
143
- puts text.length
144
-
145
- hash = {
146
- k1: 'x' * 800,
147
- k2: text,
148
- }
149
-
150
- puts ActiveSupport::JSON.encode(hash)
151
- #puts Oj::Rails::Encoder.new.encode(hash)
24
+ puts Oj.dump(data, mode: :object)
@@ -404,130 +404,6 @@ class Juice < Minitest::Test
404
404
  assert_equal('null', json)
405
405
  end
406
406
 
407
- =begin
408
- # TBD make thse tests for cusom mode
409
- def test_unix_time_custom
410
- t = Time.xmlschema("2012-01-05T23:58:07.123456000+09:00")
411
- #t = Time.local(2012, 1, 5, 23, 58, 7, 123456)
412
- json = Oj.dump(t, :mode => :custom, :time_format => :unix)
413
- assert_equal(%{1325775487.123456000}, json)
414
- end
415
- def test_unix_time_custom_precision
416
- t = Time.xmlschema("2012-01-05T23:58:07.123456789+09:00")
417
- #t = Time.local(2012, 1, 5, 23, 58, 7, 123456)
418
- json = Oj.dump(t, :mode => :custom, :second_precision => 5, :time_format => :unix)
419
- assert_equal(%{1325775487.12346}, json)
420
- t = Time.xmlschema("2012-01-05T23:58:07.999600+09:00")
421
- json = Oj.dump(t, :mode => :custom, :second_precision => 3, :time_format => :unix)
422
- assert_equal(%{1325775488.000}, json)
423
- end
424
- def test_unix_time_custom_early
425
- t = Time.xmlschema("1954-01-05T00:00:00.123456789+00:00")
426
- json = Oj.dump(t, :mode => :custom, :second_precision => 5, :time_format => :unix)
427
- assert_equal(%{-504575999.87654}, json)
428
- end
429
- def test_unix_time_custom_1970
430
- t = Time.xmlschema("1970-01-01T00:00:00.123456789+00:00")
431
- json = Oj.dump(t, :mode => :custom, :second_precision => 5, :time_format => :unix)
432
- assert_equal(%{0.12346}, json)
433
- end
434
- def test_ruby_time_custom
435
- t = Time.xmlschema("2012-01-05T23:58:07.123456000+09:00")
436
- json = Oj.dump(t, :mode => :custom, :time_format => :ruby)
437
- #assert_equal(%{"2012-01-05 23:58:07 +0900"}, json)
438
- assert_equal(%{"#{t.to_s}"}, json)
439
- end
440
- def test_xml_time_custom
441
- begin
442
- t = Time.new(2012, 1, 5, 23, 58, 7.123456000, 34200)
443
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema)
444
- assert_equal(%{"2012-01-05T23:58:07.123456000+09:30"}, json)
445
- rescue Exception
446
- # some Rubies (1.8.7) do not allow the timezome to be set
447
- t = Time.local(2012, 1, 5, 23, 58, 7, 123456)
448
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema)
449
- tz = t.utc_offset
450
- # Ruby does not handle a %+02d properly so...
451
- sign = '+'
452
- if 0 > tz
453
- sign = '-'
454
- tz = -tz
455
- end
456
- assert_equal(%{"2012-01-05T23:58:07.123456000%s%02d:%02d"} % [sign, tz / 3600, tz / 60 % 60], json)
457
- end
458
- end
459
- def test_xml_time_custom_no_secs
460
- begin
461
- t = Time.new(2012, 1, 5, 23, 58, 7.0, 34200)
462
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema)
463
- assert_equal(%{"2012-01-05T23:58:07+09:30"}, json)
464
- rescue Exception
465
- # some Rubies (1.8.7) do not allow the timezome to be set
466
- t = Time.local(2012, 1, 5, 23, 58, 7, 0)
467
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema)
468
- tz = t.utc_offset
469
- # Ruby does not handle a %+02d properly so...
470
- sign = '+'
471
- if 0 > tz
472
- sign = '-'
473
- tz = -tz
474
- end
475
- assert_equal(%{"2012-01-05T23:58:07%s%02d:%02d"} % [sign, tz / 3600, tz / 60 % 60], json)
476
- end
477
- end
478
- def test_xml_time_custom_precision
479
- begin
480
- t = Time.new(2012, 1, 5, 23, 58, 7.123456789, 32400)
481
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema, :second_precision => 5)
482
- assert_equal(%{"2012-01-05T23:58:07.12346+09:00"}, json)
483
- rescue Exception
484
- # some Rubies (1.8.7) do not allow the timezome to be set
485
- t = Time.local(2012, 1, 5, 23, 58, 7, 123456)
486
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema, :second_precision => 5)
487
- tz = t.utc_offset
488
- # Ruby does not handle a %+02d properly so...
489
- sign = '+'
490
- if 0 > tz
491
- sign = '-'
492
- tz = -tz
493
- end
494
- assert_equal(%{"2012-01-05T23:58:07.12346%s%02d:%02d"} % [sign, tz / 3600, tz / 60 % 60], json)
495
- end
496
- end
497
- def test_xml_time_custom_precision_round
498
- begin
499
- t = Time.new(2012, 1, 5, 23, 58, 7.99996, 32400)
500
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema, :second_precision => 4)
501
- assert_equal(%{"2012-01-05T23:58:08+09:00"}, json)
502
- rescue Exception
503
- # some Rubies (1.8.7) do not allow the timezome to be set
504
- t = Time.local(2012, 1, 5, 23, 58, 7, 999600)
505
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema, :second_precision => 3)
506
- tz = t.utc_offset
507
- # Ruby does not handle a %+02d properly so...
508
- sign = '+'
509
- if 0 > tz
510
- sign = '-'
511
- tz = -tz
512
- end
513
- assert_equal(%{"2012-01-05T23:58:08%s%02d:%02d"} % [sign, tz / 3600, tz / 60 % 60], json)
514
- end
515
- end
516
- def test_xml_time_custom_zulu
517
- begin
518
- t = Time.new(2012, 1, 5, 23, 58, 7.0, 0)
519
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema)
520
- assert_equal(%{"2012-01-05T23:58:07Z"}, json)
521
- rescue Exception
522
- # some Rubies (1.8.7) do not allow the timezome to be set
523
- t = Time.utc(2012, 1, 5, 23, 58, 7, 0)
524
- json = Oj.dump(t, :mode => :custom, :time_format => :xmlschema)
525
- #tz = t.utc_offset
526
- assert_equal(%{"2012-01-05T23:58:07Z"}, json)
527
- end
528
- end
529
- =end
530
-
531
407
  # Class
532
408
  def test_class_null
533
409
  json = Oj.dump(Juice, :mode => :null)
@@ -734,7 +610,7 @@ class Juice < Minitest::Test
734
610
  end
735
611
 
736
612
  def test_empty_string_true
737
- result = Oj.load(gen_whitespaced_string, :empty_string => true)
613
+ result = Oj.load(gen_whitespaced_string, :empty_string => true, mode: :strict)
738
614
  assert_nil(result)
739
615
  end
740
616
 
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.5
4
+ version: 3.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-11 00:00:00.000000000 Z
11
+ date: 2017-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: minitest
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +44,20 @@ dependencies:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
46
  version: '5'
47
+ - !ruby/object:Gem::Dependency
48
+ name: test-unit
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: wwtd
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +72,7 @@ dependencies:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
74
  version: '0'
55
- description: 'The fastest JSON parser and object serializer. '
75
+ description: The fastest JSON parser and object serializer.
56
76
  email: peter@ohler.com
57
77
  executables: []
58
78
  extensions:
@@ -240,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
260
  version: '0'
241
261
  requirements: []
242
262
  rubyforge_project: oj
243
- rubygems_version: 2.6.11
263
+ rubygems_version: 2.6.13
244
264
  signing_key:
245
265
  specification_version: 4
246
266
  summary: A fast JSON parser and serializer.