oj 2.18.4 → 2.18.5
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/ext/oj/dump.c +23 -23
- data/lib/oj/version.rb +1 -1
- data/test/curl/curl_oj.rb +46 -0
- data/test/curl/get_oj.rb +24 -0
- data/test/curl/just_curl.rb +31 -0
- data/test/curl/just_oj.rb +51 -0
- data/test/foo.rb +19 -2
- metadata +63 -66
- data/ext/oj/dump_custom.c +0 -759
- data/test/mem.rb +0 -20
- data/test/omit.rb +0 -20
- data/test/rails_datetime_test.rb +0 -24
- data/test/test_custom.rb +0 -399
- data/test/x_test.rb +0 -185
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0680538f0b702ac222fce52dacf832b743d99578'
|
4
|
+
data.tar.gz: 13a74b36cf681763823e8ca0f93a53704feafc41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a73409be107f9c6b262ad17cf6051401602910270c1d7a2929b4e9877b2b29651fb9e4f08c0436462f37d55f04d8d7c2f5fdb6cb43817ad121bdda8f3056cfdd
|
7
|
+
data.tar.gz: 21b43f4f2ebe1af8d84ece21671ea42178bdfe9b8ac9125d3b326695e792c3882490f654f62bb0a77345e43bd5658fd6e2e9fdff9d8b2d5275f561a456aa4236
|
data/ext/oj/dump.c
CHANGED
@@ -567,7 +567,7 @@ dump_float(VALUE obj, Out out) {
|
|
567
567
|
} else if (0 == out->opts->float_prec) {
|
568
568
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
569
569
|
|
570
|
-
cnt = RSTRING_LEN(rstr);
|
570
|
+
cnt = (int)RSTRING_LEN(rstr);
|
571
571
|
if ((int)sizeof(buf) <= cnt) {
|
572
572
|
cnt = sizeof(buf) - 1;
|
573
573
|
}
|
@@ -675,7 +675,7 @@ dump_cstr(const char *str, size_t cnt, int is_sym, int escape1, Out out) {
|
|
675
675
|
|
676
676
|
static void
|
677
677
|
dump_str_comp(VALUE obj, Out out) {
|
678
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&obj), RSTRING_LEN(obj), 0, 0, out);
|
678
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&obj), (int)RSTRING_LEN(obj), 0, 0, out);
|
679
679
|
}
|
680
680
|
|
681
681
|
static void
|
@@ -684,7 +684,7 @@ dump_str_obj(VALUE obj, VALUE clas, int depth, Out out) {
|
|
684
684
|
dump_obj_attrs(obj, clas, 0, depth, out);
|
685
685
|
} else {
|
686
686
|
const char *s = rb_string_value_ptr((VALUE*)&obj);
|
687
|
-
size_t len = RSTRING_LEN(obj);
|
687
|
+
size_t len = (size_t)RSTRING_LEN(obj);
|
688
688
|
char s1 = s[1];
|
689
689
|
|
690
690
|
dump_cstr(s, len, 0, (':' == *s || ('^' == *s && ('r' == s1 || 'i' == s1))), out);
|
@@ -1197,7 +1197,7 @@ static void
|
|
1197
1197
|
dump_ruby_time(VALUE obj, Out out) {
|
1198
1198
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1199
1199
|
|
1200
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1200
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1201
1201
|
}
|
1202
1202
|
|
1203
1203
|
static void
|
@@ -1307,7 +1307,7 @@ dump_data_strict(VALUE obj, Out out) {
|
|
1307
1307
|
if (oj_bigdecimal_class == clas) {
|
1308
1308
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1309
1309
|
|
1310
|
-
dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
|
1310
|
+
dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
|
1311
1311
|
} else {
|
1312
1312
|
raise_strict(obj);
|
1313
1313
|
}
|
@@ -1320,7 +1320,7 @@ dump_data_null(VALUE obj, Out out) {
|
|
1320
1320
|
if (oj_bigdecimal_class == clas) {
|
1321
1321
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1322
1322
|
|
1323
|
-
dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
|
1323
|
+
dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
|
1324
1324
|
} else {
|
1325
1325
|
dump_nil(out);
|
1326
1326
|
}
|
@@ -1345,7 +1345,7 @@ dump_data_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok)
|
|
1345
1345
|
} else if (Yes == out->opts->bigdec_as_num && oj_bigdecimal_class == clas) {
|
1346
1346
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1347
1347
|
|
1348
|
-
dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
|
1348
|
+
dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
|
1349
1349
|
} else if (as_ok && Yes == out->opts->as_json && rb_respond_to(obj, oj_as_json_id)) {
|
1350
1350
|
volatile VALUE aj;
|
1351
1351
|
|
@@ -1377,7 +1377,7 @@ dump_data_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok)
|
|
1377
1377
|
if (aj == obj) {
|
1378
1378
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1379
1379
|
|
1380
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1380
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1381
1381
|
} else {
|
1382
1382
|
dump_val(aj, depth, out, 0, 0, false);
|
1383
1383
|
}
|
@@ -1408,11 +1408,11 @@ dump_data_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok)
|
|
1408
1408
|
} else if (oj_bigdecimal_class == clas) {
|
1409
1409
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1410
1410
|
|
1411
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1411
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1412
1412
|
} else {
|
1413
1413
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1414
1414
|
|
1415
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1415
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1416
1416
|
}
|
1417
1417
|
}
|
1418
1418
|
}
|
@@ -1451,9 +1451,9 @@ dump_data_obj(VALUE obj, int depth, Out out) {
|
|
1451
1451
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1452
1452
|
|
1453
1453
|
if (Yes == out->opts->bigdec_as_num) {
|
1454
|
-
dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
|
1454
|
+
dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
|
1455
1455
|
} else {
|
1456
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1456
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1457
1457
|
}
|
1458
1458
|
} else {
|
1459
1459
|
dump_nil(out);
|
@@ -1507,7 +1507,7 @@ dump_obj_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok)
|
|
1507
1507
|
if (aj == obj) {
|
1508
1508
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1509
1509
|
|
1510
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1510
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1511
1511
|
} else {
|
1512
1512
|
dump_val(aj, depth, out, 0, 0, false);
|
1513
1513
|
}
|
@@ -1533,9 +1533,9 @@ dump_obj_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok)
|
|
1533
1533
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1534
1534
|
|
1535
1535
|
if (Yes == out->opts->bigdec_as_num) {
|
1536
|
-
dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
|
1536
|
+
dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
|
1537
1537
|
} else {
|
1538
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1538
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1539
1539
|
}
|
1540
1540
|
#if (defined T_RATIONAL && defined RRATIONAL)
|
1541
1541
|
} else if (oj_datetime_class == clas || oj_date_class == clas || rb_cRational == clas) {
|
@@ -1544,7 +1544,7 @@ dump_obj_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok)
|
|
1544
1544
|
#endif
|
1545
1545
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1546
1546
|
|
1547
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1547
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1548
1548
|
} else {
|
1549
1549
|
dump_obj_attrs(obj, Qundef, 0, depth, out);
|
1550
1550
|
}
|
@@ -1562,7 +1562,7 @@ dump_obj_obj(VALUE obj, int depth, Out out) {
|
|
1562
1562
|
if (oj_bigdecimal_class == clas) {
|
1563
1563
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1564
1564
|
|
1565
|
-
dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
|
1565
|
+
dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
|
1566
1566
|
} else {
|
1567
1567
|
dump_obj_attrs(obj, clas, id, depth, out);
|
1568
1568
|
}
|
@@ -1686,7 +1686,7 @@ dump_obj_attrs(VALUE obj, VALUE clas, slot_t id, int depth, Out out) {
|
|
1686
1686
|
*out->cur++ = 'f';
|
1687
1687
|
*out->cur++ = '"';
|
1688
1688
|
*out->cur++ = ':';
|
1689
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&obj), RSTRING_LEN(obj), 0, 0, out);
|
1689
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&obj), (int)RSTRING_LEN(obj), 0, 0, out);
|
1690
1690
|
break;
|
1691
1691
|
case T_ARRAY:
|
1692
1692
|
size = d2 * out->indent + 14;
|
@@ -1875,7 +1875,7 @@ dump_struct_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_o
|
|
1875
1875
|
if (aj == obj) {
|
1876
1876
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1877
1877
|
|
1878
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1878
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1879
1879
|
} else {
|
1880
1880
|
dump_val(aj, depth, out, 0, 0, false);
|
1881
1881
|
}
|
@@ -1894,7 +1894,7 @@ dump_struct_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_o
|
|
1894
1894
|
} else {
|
1895
1895
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
1896
1896
|
|
1897
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
1897
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
1898
1898
|
}
|
1899
1899
|
}
|
1900
1900
|
|
@@ -2032,7 +2032,7 @@ dump_odd(VALUE obj, Odd odd, VALUE clas, int depth, Out out) {
|
|
2032
2032
|
rb_raise(rb_eEncodingError, "Invalid type for raw JSON.\n");
|
2033
2033
|
} else {
|
2034
2034
|
const char *s = rb_string_value_ptr((VALUE*)&v);
|
2035
|
-
int len = RSTRING_LEN(v);
|
2035
|
+
int len = (int)RSTRING_LEN(v);
|
2036
2036
|
const char *name = rb_id2name(*odd->attrs);
|
2037
2037
|
size_t nlen = strlen(name);
|
2038
2038
|
|
@@ -2218,7 +2218,7 @@ dump_val(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok) {
|
|
2218
2218
|
case NullMode: dump_nil(out); break;
|
2219
2219
|
case CompatMode: {
|
2220
2220
|
volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
|
2221
|
-
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
|
2221
|
+
dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
|
2222
2222
|
break;
|
2223
2223
|
}
|
2224
2224
|
case ObjectMode:
|
@@ -2364,7 +2364,7 @@ dump_leaf_str(Leaf leaf, Out out) {
|
|
2364
2364
|
dump_cstr(leaf->str, strlen(leaf->str), 0, 0, out);
|
2365
2365
|
break;
|
2366
2366
|
case RUBY_VAL:
|
2367
|
-
dump_cstr(rb_string_value_cstr(&leaf->value), RSTRING_LEN(leaf->value), 0, 0, out);
|
2367
|
+
dump_cstr(rb_string_value_cstr(&leaf->value), (int)RSTRING_LEN(leaf->value), 0, 0, out);
|
2368
2368
|
break;
|
2369
2369
|
case COL_VAL:
|
2370
2370
|
default:
|
data/lib/oj/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
#$VERBOSE = true
|
5
|
+
|
6
|
+
$: << File.dirname(__FILE__)
|
7
|
+
$: << File.expand_path("../../ext")
|
8
|
+
$: << File.expand_path("../../lib")
|
9
|
+
$: << File.expand_path("../../../curb/ext")
|
10
|
+
$: << File.expand_path("../../../curb/lib")
|
11
|
+
|
12
|
+
require 'curb'
|
13
|
+
require 'oj'
|
14
|
+
|
15
|
+
$cnt = 0
|
16
|
+
|
17
|
+
$url = "localhost:7660/data.json"
|
18
|
+
|
19
|
+
begin
|
20
|
+
while true
|
21
|
+
before = GC.count
|
22
|
+
curl = Curl::Easy.new($url)
|
23
|
+
curl.ssl_verify_host = false
|
24
|
+
curl.http_get
|
25
|
+
if before != GC.count
|
26
|
+
puts " did a GC in curl #{GC.count}"
|
27
|
+
before = GC.count
|
28
|
+
end
|
29
|
+
=begin
|
30
|
+
data = Oj.load(curl.body, symbol_keys: true, mode: :strict)
|
31
|
+
puts " did a GC in Oj #{GC.count}" if before != GC.count
|
32
|
+
|
33
|
+
if data[:data].nil? or data[:data].any? { |e| e.empty? }
|
34
|
+
puts "body: #{curl.body}"
|
35
|
+
raise "FAILED"
|
36
|
+
end
|
37
|
+
=end
|
38
|
+
$cnt += 1
|
39
|
+
print "\r #{$cnt}"
|
40
|
+
end
|
41
|
+
rescue Exception => e
|
42
|
+
puts "#{e.class}: #{e.message}"
|
43
|
+
puts "url: #{$url}"
|
44
|
+
#puts "data: #{data}"
|
45
|
+
#puts "data[data]: #{data[:data]}"
|
46
|
+
end
|
data/test/curl/get_oj.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
$VERBOSE = true
|
5
|
+
|
6
|
+
$: << File.dirname(__FILE__)
|
7
|
+
$: << File.expand_path("../../ext")
|
8
|
+
$: << File.expand_path("../../lib")
|
9
|
+
|
10
|
+
require 'net/http'
|
11
|
+
require 'uri'
|
12
|
+
require 'oj'
|
13
|
+
|
14
|
+
$url = URI.parse("http://localhost:7660/data.json")
|
15
|
+
|
16
|
+
$cnt = 0
|
17
|
+
|
18
|
+
while true
|
19
|
+
response = Net::HTTP.get_response($url)
|
20
|
+
data = Oj.load(response.body, symbol_keys: true, mode: :strict)
|
21
|
+
raise "FAILED" if data[:data].any? { |e| e.empty? }
|
22
|
+
$cnt += 1
|
23
|
+
print "\r #{$cnt}"
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
#$VERBOSE = true
|
5
|
+
|
6
|
+
$: << File.dirname(__FILE__)
|
7
|
+
#$: << File.expand_path("../../../curb/ext")
|
8
|
+
#$: << File.expand_path("../../../curb/lib")
|
9
|
+
|
10
|
+
require 'curb'
|
11
|
+
|
12
|
+
$cnt = 0
|
13
|
+
$url = "localhost:7660/data.json"
|
14
|
+
|
15
|
+
begin
|
16
|
+
while true
|
17
|
+
before = GC.count
|
18
|
+
curl = Curl::Easy.new($url)
|
19
|
+
curl.ssl_verify_host = false
|
20
|
+
curl.http_get
|
21
|
+
if before != GC.count
|
22
|
+
puts " did a GC in curl #{GC.count}"
|
23
|
+
before = GC.count
|
24
|
+
end
|
25
|
+
$cnt += 1
|
26
|
+
print "\r #{$cnt}"
|
27
|
+
end
|
28
|
+
rescue Exception => e
|
29
|
+
puts "#{e.class}: #{e.message}"
|
30
|
+
puts "url: #{$url}"
|
31
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
$VERBOSE = true
|
5
|
+
|
6
|
+
$: << File.dirname(__FILE__)
|
7
|
+
$: << File.expand_path("../../ext")
|
8
|
+
$: << File.expand_path("../../lib")
|
9
|
+
|
10
|
+
require 'oj'
|
11
|
+
|
12
|
+
$json = %|
|
13
|
+
{
|
14
|
+
"data" : [ {
|
15
|
+
"action" : "login",
|
16
|
+
"event" : "user",
|
17
|
+
"field" : "login",
|
18
|
+
"value" : "foobar",
|
19
|
+
"info" : "Authenticated \\"Foo Bar\\"",
|
20
|
+
"id" : "585929918297f2740ed9f5f0",
|
21
|
+
"_metadata" : {
|
22
|
+
"version" : "1"
|
23
|
+
},
|
24
|
+
"timestamp" : "2016-12-20T07:52:33",
|
25
|
+
"key_id" : "4"
|
26
|
+
} ],
|
27
|
+
"info" : {
|
28
|
+
"view" : "partial",
|
29
|
+
"limit" : 500,
|
30
|
+
"offset" : 2000,
|
31
|
+
"results" : 500,
|
32
|
+
"ordering" : "timestamp desc,id",
|
33
|
+
"previous" : "https://api.server.com/some/path/event?calculate_total=false&draft=base&order_by=timestamp_desc&order_by=id&subdraft=none&offset=1500&limit=500",
|
34
|
+
"next" : "https://api.server.com/some/path/event?calculate_total=false&draft=base&order_by=timestamp_desc&order_by=id&subdraft=none&offset=2500&limit=500",
|
35
|
+
"draft" : "base",
|
36
|
+
"subdraft" : "none",
|
37
|
+
"total_results" : 100000
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
|
41
|
+
|
42
|
+
$cnt = 0
|
43
|
+
|
44
|
+
while true
|
45
|
+
before = GC.count
|
46
|
+
data = Oj.load($json, symbol_keys: true, mode: :strict)
|
47
|
+
puts " did a GC in Oj #{GC.count} - #{$cnt}" if before != GC.count
|
48
|
+
raise "FAILED" if data[:data].any? { |e| e.empty? }
|
49
|
+
$cnt += 1
|
50
|
+
print "\r #{$cnt}" if 0 == ($cnt % 10000)
|
51
|
+
end
|
data/test/foo.rb
CHANGED
@@ -1,7 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
+
$VERBOSE = true
|
5
|
+
|
6
|
+
here = File.expand_path(File.dirname(__FILE__))
|
4
7
|
$: << File.dirname(__FILE__)
|
8
|
+
$: << File.join(File.dirname(here), 'ext')
|
9
|
+
$: << File.join(File.dirname(here), 'lib')
|
10
|
+
|
11
|
+
require 'oj'
|
12
|
+
|
13
|
+
Oj.mimic_JSON()
|
14
|
+
|
15
|
+
class Foo
|
16
|
+
def as_json
|
17
|
+
{ foo: 'bar' }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
opts = {}
|
5
22
|
|
6
|
-
|
7
|
-
|
23
|
+
puts Foo.new.to_json
|
24
|
+
puts Foo.new.to_json(opts)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.18.
|
4
|
+
version: 2.18.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
@@ -69,7 +69,6 @@ files:
|
|
69
69
|
- ext/oj/circarray.h
|
70
70
|
- ext/oj/compat.c
|
71
71
|
- ext/oj/dump.c
|
72
|
-
- ext/oj/dump_custom.c
|
73
72
|
- ext/oj/encode.h
|
74
73
|
- ext/oj/err.c
|
75
74
|
- ext/oj/err.h
|
@@ -114,6 +113,10 @@ files:
|
|
114
113
|
- test/bug_fast.rb
|
115
114
|
- test/bug_load.rb
|
116
115
|
- test/crash.rb
|
116
|
+
- test/curl/curl_oj.rb
|
117
|
+
- test/curl/get_oj.rb
|
118
|
+
- test/curl/just_curl.rb
|
119
|
+
- test/curl/just_oj.rb
|
117
120
|
- test/example.rb
|
118
121
|
- test/files.rb
|
119
122
|
- test/foo.rb
|
@@ -129,9 +132,7 @@ files:
|
|
129
132
|
- test/isolated/test_mimic_rails_before.rb
|
130
133
|
- test/isolated/test_mimic_rails_datetime.rb
|
131
134
|
- test/isolated/test_mimic_redefine.rb
|
132
|
-
- test/mem.rb
|
133
135
|
- test/mod.rb
|
134
|
-
- test/omit.rb
|
135
136
|
- test/perf.rb
|
136
137
|
- test/perf_compat.rb
|
137
138
|
- test/perf_fast.rb
|
@@ -142,7 +143,6 @@ files:
|
|
142
143
|
- test/perf_simple.rb
|
143
144
|
- test/perf_strict.rb
|
144
145
|
- test/rails.rb
|
145
|
-
- test/rails_datetime_test.rb
|
146
146
|
- test/russian.rb
|
147
147
|
- test/sample.rb
|
148
148
|
- test/sample/change.rb
|
@@ -160,7 +160,6 @@ files:
|
|
160
160
|
- test/sample_json.rb
|
161
161
|
- test/struct.rb
|
162
162
|
- test/test_compat.rb
|
163
|
-
- test/test_custom.rb
|
164
163
|
- test/test_debian.rb
|
165
164
|
- test/test_fast.rb
|
166
165
|
- test/test_file.rb
|
@@ -174,7 +173,6 @@ files:
|
|
174
173
|
- test/test_various.rb
|
175
174
|
- test/test_writer.rb
|
176
175
|
- test/write_timebars.rb
|
177
|
-
- test/x_test.rb
|
178
176
|
homepage: http://www.ohler.com/oj
|
179
177
|
licenses:
|
180
178
|
- MIT
|
@@ -202,74 +200,73 @@ signing_key:
|
|
202
200
|
specification_version: 4
|
203
201
|
summary: A fast JSON parser and serializer.
|
204
202
|
test_files:
|
205
|
-
- test/perf_object.rb
|
206
|
-
- test/test_hash.rb
|
207
|
-
- test/test_custom.rb
|
208
|
-
- test/bug3.rb
|
209
|
-
- test/write_timebars.rb
|
210
|
-
- test/test_writer.rb
|
211
|
-
- test/russian.rb
|
212
|
-
- test/rails_datetime_test.rb
|
213
|
-
- test/omit.rb
|
214
|
-
- test/test_gc.rb
|
215
|
-
- test/_test_active_mimic.rb
|
216
|
-
- test/test_serializer.rb
|
217
|
-
- test/sample/file.rb
|
218
|
-
- test/sample/group.rb
|
219
|
-
- test/sample/oval.rb
|
220
|
-
- test/sample/rect.rb
|
221
|
-
- test/sample/hasprops.rb
|
222
|
-
- test/sample/layer.rb
|
223
|
-
- test/sample/text.rb
|
224
|
-
- test/sample/doc.rb
|
225
|
-
- test/sample/line.rb
|
226
|
-
- test/sample/dir.rb
|
227
|
-
- test/sample/shape.rb
|
228
|
-
- test/sample/change.rb
|
229
|
-
- test/crash.rb
|
230
|
-
- test/io.rb
|
231
|
-
- test/test_object.rb
|
232
|
-
- test/struct.rb
|
233
|
-
- test/mod.rb
|
234
|
-
- test/sample.rb
|
235
|
-
- test/perf_scp.rb
|
236
|
-
- test/bug2.rb
|
237
|
-
- test/test_saj.rb
|
238
|
-
- test/test_strict.rb
|
239
|
-
- test/perf_saj.rb
|
240
|
-
- test/perf_simple.rb
|
241
|
-
- test/perf_fast.rb
|
242
|
-
- test/example.rb
|
243
203
|
- test/_test_active.rb
|
244
|
-
- test/
|
245
|
-
- test/
|
204
|
+
- test/_test_active_mimic.rb
|
205
|
+
- test/_test_mimic_rails.rb
|
246
206
|
- test/activesupport_datetime_test.rb
|
247
|
-
- test/
|
207
|
+
- test/bug.rb
|
208
|
+
- test/bug2.rb
|
209
|
+
- test/bug3.rb
|
210
|
+
- test/bug_fast.rb
|
248
211
|
- test/bug_load.rb
|
212
|
+
- test/crash.rb
|
213
|
+
- test/curl/curl_oj.rb
|
214
|
+
- test/curl/get_oj.rb
|
215
|
+
- test/curl/just_curl.rb
|
216
|
+
- test/curl/just_oj.rb
|
217
|
+
- test/example.rb
|
249
218
|
- test/files.rb
|
250
|
-
- test/x_test.rb
|
251
219
|
- test/foo.rb
|
252
|
-
- test/
|
253
|
-
- test/
|
254
|
-
- test/isolated/test_mimic_redefine.rb
|
255
|
-
- test/isolated/test_mimic_as_json.rb
|
220
|
+
- test/helper.rb
|
221
|
+
- test/io.rb
|
256
222
|
- test/isolated/shared.rb
|
257
|
-
- test/isolated/test_mimic_alone.rb
|
258
223
|
- test/isolated/test_mimic_after.rb
|
224
|
+
- test/isolated/test_mimic_alone.rb
|
225
|
+
- test/isolated/test_mimic_as_json.rb
|
259
226
|
- test/isolated/test_mimic_before.rb
|
260
|
-
- test/isolated/test_mimic_rails_before.rb
|
261
227
|
- test/isolated/test_mimic_define.rb
|
262
|
-
- test/
|
263
|
-
- test/
|
264
|
-
- test/
|
265
|
-
- test/
|
228
|
+
- test/isolated/test_mimic_rails_after.rb
|
229
|
+
- test/isolated/test_mimic_rails_before.rb
|
230
|
+
- test/isolated/test_mimic_rails_datetime.rb
|
231
|
+
- test/isolated/test_mimic_redefine.rb
|
232
|
+
- test/mod.rb
|
233
|
+
- test/perf.rb
|
234
|
+
- test/perf_compat.rb
|
235
|
+
- test/perf_fast.rb
|
236
|
+
- test/perf_file.rb
|
237
|
+
- test/perf_object.rb
|
238
|
+
- test/perf_saj.rb
|
239
|
+
- test/perf_scp.rb
|
240
|
+
- test/perf_simple.rb
|
241
|
+
- test/perf_strict.rb
|
242
|
+
- test/rails.rb
|
243
|
+
- test/russian.rb
|
244
|
+
- test/sample/change.rb
|
245
|
+
- test/sample/dir.rb
|
246
|
+
- test/sample/doc.rb
|
247
|
+
- test/sample/file.rb
|
248
|
+
- test/sample/group.rb
|
249
|
+
- test/sample/hasprops.rb
|
250
|
+
- test/sample/layer.rb
|
251
|
+
- test/sample/line.rb
|
252
|
+
- test/sample/oval.rb
|
253
|
+
- test/sample/rect.rb
|
254
|
+
- test/sample/shape.rb
|
255
|
+
- test/sample/text.rb
|
256
|
+
- test/sample.rb
|
266
257
|
- test/sample_json.rb
|
258
|
+
- test/struct.rb
|
259
|
+
- test/test_compat.rb
|
267
260
|
- test/test_debian.rb
|
268
261
|
- test/test_fast.rb
|
269
|
-
- test/
|
270
|
-
- test/
|
271
|
-
- test/
|
272
|
-
- test/
|
273
|
-
- test/
|
274
|
-
- test/
|
275
|
-
- test/
|
262
|
+
- test/test_file.rb
|
263
|
+
- test/test_gc.rb
|
264
|
+
- test/test_hash.rb
|
265
|
+
- test/test_object.rb
|
266
|
+
- test/test_saj.rb
|
267
|
+
- test/test_scp.rb
|
268
|
+
- test/test_serializer.rb
|
269
|
+
- test/test_strict.rb
|
270
|
+
- test/test_various.rb
|
271
|
+
- test/test_writer.rb
|
272
|
+
- test/write_timebars.rb
|