oj 3.7.4 → 3.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oj/dump.c +30 -4
- data/ext/oj/mimic_json.c +1 -1
- data/ext/oj/oj.h +2 -1
- data/ext/oj/rails.c +2 -2
- data/lib/oj/version.rb +1 -1
- data/pages/Modes.md +43 -43
- data/test/big.rb +15 -0
- data/test/foo.rb +16 -67
- data/test/mem.rb +35 -0
- data/test/test_compat.rb +5 -0
- metadata +70 -68
- data/test/bar.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b79a00294bf924b3e584d91bf719d1b0e74fd567d8b677b394930a7825bda34
|
4
|
+
data.tar.gz: 402f51a51d76e0f3ac1e6527b0b00a67885bc1c25d246388ab96e0ccf1354e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab6be5b3ec6fd7f98323d38c7efe439f309d70b59ab12acfd02fb0290b99b8ba39b7d8ee9a2cd34d9a8a6f2fb69391bcaedb5c680f059df0da840e42f6484bc
|
7
|
+
data.tar.gz: 9b36cb9b71beaed79b0b5d3ff8f277366b105d7c51a78e93a465824d6a86afffac16c9f719b46dcbc00337130b55bf6ccf4912eea7180c07d86ef48a9fc2419e
|
data/ext/oj/dump.c
CHANGED
@@ -85,6 +85,17 @@ static char xss_friendly_chars[256] = "\
|
|
85
85
|
// JSON XSS combo
|
86
86
|
static char hixss_friendly_chars[256] = "\
|
87
87
|
66666666222622666666666666666666\
|
88
|
+
11211111111111111111111111111111\
|
89
|
+
11111111111111111111111111112111\
|
90
|
+
11111111111111111111111111111111\
|
91
|
+
11111111111111111111111111111111\
|
92
|
+
11111111111111111111111111111111\
|
93
|
+
11111111111111111111111111111111\
|
94
|
+
11611111111111111111111111111111";
|
95
|
+
|
96
|
+
// Rails XSS combo
|
97
|
+
static char rails_xss_friendly_chars[256] = "\
|
98
|
+
66666666222622666666666666666666\
|
88
99
|
11211161111111111111111111116161\
|
89
100
|
11111111111111111111111111112111\
|
90
101
|
11111111111111111111111111111111\
|
@@ -168,6 +179,17 @@ hixss_friendly_size(const uint8_t *str, size_t len) {
|
|
168
179
|
return size - len * (size_t)'0' + check;
|
169
180
|
}
|
170
181
|
|
182
|
+
inline static size_t
|
183
|
+
rails_xss_friendly_size(const uint8_t *str, size_t len) {
|
184
|
+
size_t size = 0;
|
185
|
+
size_t i = len;
|
186
|
+
|
187
|
+
for (; 0 < i; str++, i--) {
|
188
|
+
size += rails_xss_friendly_chars[*str];
|
189
|
+
}
|
190
|
+
return size - len * (size_t)'0';
|
191
|
+
}
|
192
|
+
|
171
193
|
inline static size_t
|
172
194
|
rails_friendly_size(const uint8_t *str, size_t len) {
|
173
195
|
size_t size = 0;
|
@@ -754,6 +776,10 @@ oj_dump_cstr(const char *str, size_t cnt, bool is_sym, bool escape1, Out out) {
|
|
754
776
|
cmap = hixss_friendly_chars;
|
755
777
|
size = hixss_friendly_size((uint8_t*)str, cnt);
|
756
778
|
break;
|
779
|
+
case RailsXEsc:
|
780
|
+
cmap = rails_xss_friendly_chars;
|
781
|
+
size = rails_xss_friendly_size((uint8_t*)str, cnt);
|
782
|
+
break;
|
757
783
|
case RailsEsc:
|
758
784
|
cmap = rails_friendly_chars;
|
759
785
|
size = rails_friendly_size((uint8_t*)str, cnt);
|
@@ -795,7 +821,7 @@ oj_dump_cstr(const char *str, size_t cnt, bool is_sym, bool escape1, Out out) {
|
|
795
821
|
for (; str < end; str++) {
|
796
822
|
switch (cmap[(uint8_t)*str]) {
|
797
823
|
case '1':
|
798
|
-
if (JXEsc == out->opts->escape_mode && check_start <= str) {
|
824
|
+
if ((JXEsc == out->opts->escape_mode || RailsXEsc == out->opts->escape_mode) && check_start <= str) {
|
799
825
|
if (0 != (0x80 & (uint8_t)*str)) {
|
800
826
|
if (0xC0 == (0xC0 & (uint8_t)*str)) {
|
801
827
|
check_start = check_unicode(str, end, orig);
|
@@ -819,7 +845,7 @@ oj_dump_cstr(const char *str, size_t cnt, bool is_sym, bool escape1, Out out) {
|
|
819
845
|
}
|
820
846
|
break;
|
821
847
|
case '3': // Unicode
|
822
|
-
if (0xe2 == (uint8_t)*str && JXEsc == out->opts->escape_mode && 2 <= end - str) {
|
848
|
+
if (0xe2 == (uint8_t)*str && (JXEsc == out->opts->escape_mode || RailsXEsc == out->opts->escape_mode) && 2 <= end - str) {
|
823
849
|
if (0x80 == (uint8_t)str[1] && (0xa8 == (uint8_t)str[2] || 0xa9 == (uint8_t)str[2])) {
|
824
850
|
str = dump_unicode(str, end, out, orig);
|
825
851
|
} else {
|
@@ -838,7 +864,7 @@ oj_dump_cstr(const char *str, size_t cnt, bool is_sym, bool escape1, Out out) {
|
|
838
864
|
*out->cur++ = '0';
|
839
865
|
dump_hex((uint8_t)*str, out);
|
840
866
|
} else {
|
841
|
-
if (0xe2 == (uint8_t)*str && JXEsc == out->opts->escape_mode && 2 <= end - str) {
|
867
|
+
if (0xe2 == (uint8_t)*str && (JXEsc == out->opts->escape_mode || RailsXEsc == out->opts->escape_mode) && 2 <= end - str) {
|
842
868
|
if (0x80 == (uint8_t)str[1] && (0xa8 == (uint8_t)str[2] || 0xa9 == (uint8_t)str[2])) {
|
843
869
|
str = dump_unicode(str, end, out, orig);
|
844
870
|
} else {
|
@@ -856,7 +882,7 @@ oj_dump_cstr(const char *str, size_t cnt, bool is_sym, bool escape1, Out out) {
|
|
856
882
|
}
|
857
883
|
*out->cur++ = '"';
|
858
884
|
}
|
859
|
-
if (JXEsc == out->opts->escape_mode && 0 < str - orig && 0 != (0x80 & *(str - 1))) {
|
885
|
+
if ((JXEsc == out->opts->escape_mode || RailsXEsc == out->opts->escape_mode) && 0 < str - orig && 0 != (0x80 & *(str - 1))) {
|
860
886
|
uint8_t c = (uint8_t)*(str - 1);
|
861
887
|
int i;
|
862
888
|
int scnt = (int)(str - orig);
|
data/ext/oj/mimic_json.c
CHANGED
@@ -167,7 +167,7 @@ oj_parse_mimic_dump_options(VALUE ropts, Options copts) {
|
|
167
167
|
if (Qnil != (v = rb_hash_lookup(ropts, oj_ascii_only_sym))) {
|
168
168
|
// generate seems to assume anything except nil and false are true.
|
169
169
|
if (Qfalse == v) {
|
170
|
-
copts->escape_mode = JXEsc;
|
170
|
+
copts->escape_mode = JXEsc;
|
171
171
|
} else {
|
172
172
|
copts->escape_mode = ASCIIEsc;
|
173
173
|
}
|
data/ext/oj/oj.h
CHANGED
data/ext/oj/rails.c
CHANGED
@@ -917,7 +917,7 @@ encode(VALUE obj, ROptTable ropts, Options opts, int argc, VALUE *argv) {
|
|
917
917
|
copts.str_rx.tail = NULL;
|
918
918
|
copts.mode = RailsMode;
|
919
919
|
if (escape_html) {
|
920
|
-
copts.escape_mode =
|
920
|
+
copts.escape_mode = RailsXEsc;
|
921
921
|
} else {
|
922
922
|
copts.escape_mode = RailsEsc;
|
923
923
|
}
|
@@ -1481,7 +1481,7 @@ oj_dump_rails_val(VALUE obj, int depth, Out out) {
|
|
1481
1481
|
out->opts->str_rx.head = NULL;
|
1482
1482
|
out->opts->str_rx.tail = NULL;
|
1483
1483
|
if (escape_html) {
|
1484
|
-
out->opts->escape_mode =
|
1484
|
+
out->opts->escape_mode = RailsXEsc;
|
1485
1485
|
} else {
|
1486
1486
|
out->opts->escape_mode = RailsEsc;
|
1487
1487
|
}
|
data/lib/oj/version.rb
CHANGED
data/pages/Modes.md
CHANGED
@@ -84,49 +84,49 @@ options available in each mode. An `x` in the matrix indicates the option is
|
|
84
84
|
supported in that mode. A number indicates the footnotes describe additional
|
85
85
|
information.
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
87
|
+
| Option | type | :null | :strict | :compat | :rails | :object | :custom | :wab |
|
88
|
+
| ---------------------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |
|
89
|
+
| :allow_blank | Boolean | | | 1 | 1 | | x | |
|
90
|
+
| :allow_gc | Boolean | x | x | x | x | x | x | |
|
91
|
+
| :allow_invalid_unicode | Boolean | | | | | x | x | |
|
92
|
+
| :allow_nan | Boolean | | | x | | x | x | |
|
93
|
+
| :array_class | Class | | | x | x | | x | |
|
94
|
+
| :array_nl | String | | | | | | x | |
|
95
|
+
| :ascii_only | Boolean | x | x | 2 | 2 | x | x | |
|
96
|
+
| :auto_define | Boolean | | | | | x | x | |
|
97
|
+
| :bigdecimal_as_decimal | Boolean | | | | 3 | x | x | |
|
98
|
+
| :bigdecimal_load | Boolean | | | | | | x | |
|
99
|
+
| :circular | Boolean | x | x | x | x | x | x | |
|
100
|
+
| :class_cache | Boolean | | | | | x | x | |
|
101
|
+
| :create_additions | Boolean | | | x | x | | x | |
|
102
|
+
| :create_id | String | | | x | x | | x | |
|
103
|
+
| :empty_string | Boolean | | | | | | x | |
|
104
|
+
| :escape_mode | Symbol | | | | | | x | |
|
105
|
+
| :float_precision | Fixnum | x | x | | | | x | |
|
106
|
+
| :hash_class | Class | | | x | x | | x | |
|
107
|
+
| :ignore | Array | | | | | x | x | |
|
108
|
+
| :indent | Integer | x | x | 3 | 4 | x | x | x |
|
109
|
+
| :indent_str | String | | | x | x | | x | |
|
110
|
+
| :integer_range | Range | x | x | x | x | x | x | x |
|
111
|
+
| :match_string | Hash | | | x | x | | x | |
|
112
|
+
| :max_nesting | Fixnum | 4 | 4 | x | | 5 | 4 | |
|
113
|
+
| :mode | Symbol | - | - | - | - | - | - | |
|
114
|
+
| :nan | Symbol | | | | | | x | |
|
115
|
+
| :nilnil | Boolean | | | | | | x | |
|
116
|
+
| :object_class | Class | | | x | | | x | |
|
117
|
+
| :object_nl | String | | | x | x | | x | |
|
118
|
+
| :omit_nil | Boolean | x | x | x | x | x | x | |
|
119
|
+
| :quirks_mode | Boolean | | | 6 | | | x | |
|
120
|
+
| :second_precision | Fixnum | | | | | x | x | |
|
121
|
+
| :space | String | | | x | x | | x | |
|
122
|
+
| :space_before | String | | | x | x | | x | |
|
123
|
+
| :symbol_keys | Boolean | x | x | x | x | x | x | |
|
124
|
+
| :trace | Boolean | x | x | x | x | x | x | x |
|
125
|
+
| :time_format | Symbol | | | | | x | x | |
|
126
|
+
| :use_as_json | Boolean | | | | | | x | |
|
127
|
+
| :use_to_hash | Boolean | | | | | | x | |
|
128
|
+
| :use_to_json | Boolean | | | | | | x | |
|
129
|
+
--------------------------------------------------------------------------------------------------------
|
130
130
|
|
131
131
|
1. :allow_blank an alias for :nilnil.
|
132
132
|
|
data/test/big.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#require 'active_support'
|
2
|
+
#require 'active_support/core_ext'
|
3
|
+
#require 'active_support/json'
|
4
|
+
require 'oj'
|
5
|
+
|
6
|
+
#Oj.optimize_rails
|
7
|
+
Oj.mimic_JSON
|
8
|
+
|
9
|
+
h = {:type=>:record, :name=>:group, :namespace=>"com.salsify.identity", :fields=>[{:name=>"id", :type=>{:name=>:salsify_uuid, :type=>:fixed, :namespace=>"com.salsify", :size=>38}}, {:name=>"type", :type=>"string", :default=>"groups"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"name", :type=>"string"}, {:name=>"policy", :type=>[:null, {:type=>:record, :name=>:policy, :namespace=>"com.salsify.security", :fields=>[{:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :default=>"policies"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"name", :type=>"string"}, {:name=>"statements", :type=>{:type=>:array, :items=>{:type=>:record, :name=>:statement, :namespace=>"com.salsify.security", :fields=>[{:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :default=>"statements"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"action", :type=>{:name=>"__statement_action_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:manage, :read]}}, {:name=>"resource", :type=>{:name=>"__statement_resource_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:product, :digital_asset]}}, {:name=>"conditions", :type=>{:type=>:array, :items=>{:type=>:record, :name=>:condition, :namespace=>"com.salsify.security", :fields=>[{:name=>"created_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"updated_at", :type=>{:type=>"long", :logicalType=>"timestamp-micros"}}, {:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :default=>"conditions"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}, {:name=>"operator", :type=>{:name=>"__condition_operator_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:equals]}}, {:name=>"attribute_type", :type=>{:name=>"__condition_attribute_type_enum", :type=>:enum, :namespace=>"com.salsify.security", :symbols=>[:resource]}}, {:name=>"value", :type=>"string"}, {:name=>"attribute", :type=>[:null, {:type=>:record, :name=>:reference, :namespace=>"com.salsify", :fields=>[{:name=>"id", :type=>"com.salsify.salsify_uuid"}, {:name=>"type", :type=>"string", :doc=>"snake_case, plural name for the resource type"}, {:name=>"external_id", :type=>[:null, "string"], :default=>nil}]}], :default=>nil}, {:name=>"broken", :type=>[:null, "boolean"], :default=>nil}]}}}]}}}]}], :default=>nil}]}
|
10
|
+
|
11
|
+
#Oj.dump(h)
|
12
|
+
puts JSON.pretty_generate(h)
|
13
|
+
#puts JSON.fast_generate(h)
|
14
|
+
#puts JSON.generate(h)
|
15
|
+
|
data/test/foo.rb
CHANGED
@@ -1,83 +1,32 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
2
|
|
4
|
-
$: <<
|
5
|
-
|
6
|
-
|
7
|
-
$: << File.join($oj_dir, dir)
|
8
|
-
end
|
3
|
+
$: << '.'
|
4
|
+
$: << '../lib'
|
5
|
+
$: << '../ext'
|
9
6
|
|
10
7
|
require 'oj'
|
11
|
-
require 'tracer'
|
12
8
|
|
13
|
-
#Tracer.on
|
14
9
|
|
15
10
|
class MyParser
|
16
|
-
attr_accessor :enum
|
17
|
-
|
18
11
|
def initialize
|
19
|
-
@
|
20
|
-
@writer = Oj::StreamWriter.new(@io)
|
21
|
-
|
22
|
-
json_string = Oj.dump({ records: 1.upto(2).map{|i| { id: i, name: "record_#{i}" }} }, mode: :strict)
|
23
|
-
@test_json = StringIO.new(json_string)
|
24
|
-
|
25
|
-
@enum = Enumerator.new do |yielder|
|
26
|
-
@yielder = yielder
|
27
|
-
Oj.sc_parse(self, @test_json)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Stream parsing methods
|
32
|
-
def hash_start
|
33
|
-
@writer.push_object
|
34
|
-
end
|
35
|
-
|
36
|
-
def hash_end
|
37
|
-
@writer.pop unless @io.eof
|
12
|
+
@current_depth = 0
|
38
13
|
end
|
39
14
|
|
40
|
-
def
|
41
|
-
|
15
|
+
def parse(file)
|
16
|
+
Oj.sc_parse(self, file)
|
42
17
|
end
|
43
18
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
@writer.push_array
|
50
|
-
end
|
51
|
-
|
52
|
-
def array_end
|
53
|
-
@writer.pop
|
54
|
-
end
|
55
|
-
|
56
|
-
def array_append(a, value)
|
57
|
-
yield_data
|
58
|
-
end
|
59
|
-
|
60
|
-
def add_value(value);end
|
61
|
-
|
62
|
-
def yield_data
|
63
|
-
@writer.pop_all
|
64
|
-
@yielder << @io.string
|
65
|
-
@io.reopen("")
|
66
|
-
array_start
|
19
|
+
def hash_start
|
20
|
+
puts "start"
|
21
|
+
@current_depth += 1
|
22
|
+
raise Exception.new("Hello")
|
23
|
+
{}
|
67
24
|
end
|
68
|
-
end
|
69
|
-
|
70
|
-
#puts MyParser.new.enum.to_a
|
71
|
-
|
72
|
-
puts "------------"
|
73
|
-
|
74
|
-
MyError = Class.new(StandardError)
|
75
25
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
#raise StopIteration if i == 0
|
80
|
-
#break if i >= 4
|
26
|
+
# Other Oj::ScHandler methods go below.
|
27
|
+
# The parser's purpose is to find a specific value nested deep within the streaming JSON
|
28
|
+
# and to stop parsing immediately afterward.
|
81
29
|
end
|
82
30
|
|
83
|
-
|
31
|
+
parser = MyParser.new
|
32
|
+
parser.parse(%|{"a":{"b":{"c":{}}}}|)
|
data/test/mem.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$: << '.'
|
4
|
+
$: << '../lib'
|
5
|
+
$: << '../ext'
|
6
|
+
|
7
|
+
require 'objspace'
|
8
|
+
require 'oj'
|
9
|
+
require 'json'
|
10
|
+
require 'get_process_mem'
|
11
|
+
|
12
|
+
def record_allocation
|
13
|
+
GC.start
|
14
|
+
GC.start
|
15
|
+
|
16
|
+
mem = GetProcessMem.new
|
17
|
+
puts "Before - Process Memory: #{mem.mb} mb"
|
18
|
+
puts "Before - Objects count: #{ObjectSpace.each_object.count}"
|
19
|
+
puts "Before - Symbols count: #{Symbol.all_symbols.size}"
|
20
|
+
|
21
|
+
yield
|
22
|
+
|
23
|
+
GC.start
|
24
|
+
GC.start
|
25
|
+
GC.start
|
26
|
+
|
27
|
+
puts "After - Process Memory: #{mem.mb} mb"
|
28
|
+
puts "After - Objects count: #{ObjectSpace.each_object.count}"
|
29
|
+
puts "After - Symbols count: #{Symbol.all_symbols.size}"
|
30
|
+
end
|
31
|
+
|
32
|
+
record_allocation do
|
33
|
+
data = 1_000_000.times.map { |i| "string_number_#{i}".to_sym } # array of symbols
|
34
|
+
Oj.dump(data, mode: :rails)
|
35
|
+
end
|
data/test/test_compat.rb
CHANGED
@@ -243,6 +243,11 @@ class CompatJuice < Minitest::Test
|
|
243
243
|
assert_equal({"a\nb" => true, "c\td" => false}, obj)
|
244
244
|
end
|
245
245
|
|
246
|
+
def test_hash_escaping
|
247
|
+
json = Oj.to_json({'<>' => '<>'}, mode: :compat)
|
248
|
+
assert_equal(json, '{"<>":"<>"}')
|
249
|
+
end
|
250
|
+
|
246
251
|
def test_bignum_object
|
247
252
|
dump_and_load(7 ** 55, false)
|
248
253
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.7.
|
4
|
+
version: 3.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -79,16 +79,16 @@ extensions:
|
|
79
79
|
- ext/oj/extconf.rb
|
80
80
|
extra_rdoc_files:
|
81
81
|
- README.md
|
82
|
-
- pages/
|
83
|
-
- pages/JsonGem.md
|
84
|
-
- pages/Encoding.md
|
85
|
-
- pages/WAB.md
|
86
|
-
- pages/Custom.md
|
82
|
+
- pages/Modes.md
|
87
83
|
- pages/Advanced.md
|
88
84
|
- pages/Options.md
|
85
|
+
- pages/Custom.md
|
89
86
|
- pages/Compatibility.md
|
90
|
-
- pages/
|
87
|
+
- pages/WAB.md
|
91
88
|
- pages/Security.md
|
89
|
+
- pages/Encoding.md
|
90
|
+
- pages/JsonGem.md
|
91
|
+
- pages/Rails.md
|
92
92
|
files:
|
93
93
|
- LICENSE
|
94
94
|
- README.md
|
@@ -175,7 +175,7 @@ files:
|
|
175
175
|
- test/activesupport5/encoding_test_cases.rb
|
176
176
|
- test/activesupport5/test_helper.rb
|
177
177
|
- test/activesupport5/time_zone_test_helpers.rb
|
178
|
-
- test/
|
178
|
+
- test/big.rb
|
179
179
|
- test/files.rb
|
180
180
|
- test/foo.rb
|
181
181
|
- test/helper.rb
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- test/json_gem/json_parser_test.rb
|
199
199
|
- test/json_gem/json_string_matching_test.rb
|
200
200
|
- test/json_gem/test_helper.rb
|
201
|
+
- test/mem.rb
|
201
202
|
- test/perf.rb
|
202
203
|
- test/perf_compat.rb
|
203
204
|
- test/perf_fast.rb
|
@@ -276,81 +277,82 @@ signing_key:
|
|
276
277
|
specification_version: 4
|
277
278
|
summary: A fast JSON parser and serializer.
|
278
279
|
test_files:
|
279
|
-
- test/foo.rb
|
280
|
-
- test/test_integer_range.rb
|
281
|
-
- test/test_strict.rb
|
282
|
-
- test/perf_strict.rb
|
283
|
-
- test/tests.rb
|
284
|
-
- test/perf_saj.rb
|
285
|
-
- test/test_compat.rb
|
286
|
-
- test/helper.rb
|
287
280
|
- test/perf_file.rb
|
288
|
-
- test/
|
289
|
-
- test/
|
290
|
-
- test/
|
291
|
-
- test/
|
292
|
-
- test/
|
293
|
-
- test/
|
281
|
+
- test/test_hash.rb
|
282
|
+
- test/perf.rb
|
283
|
+
- test/test_object.rb
|
284
|
+
- test/test_null.rb
|
285
|
+
- test/test_compat.rb
|
286
|
+
- test/test_custom.rb
|
287
|
+
- test/perf_scp.rb
|
288
|
+
- test/test_integer_range.rb
|
289
|
+
- test/test_gc.rb
|
290
|
+
- test/sample.rb
|
294
291
|
- test/json_gem/json_string_matching_test.rb
|
295
|
-
- test/json_gem/
|
296
|
-
- test/json_gem/json_generator_test.rb
|
292
|
+
- test/json_gem/json_addition_test.rb
|
297
293
|
- test/json_gem/test_helper.rb
|
298
|
-
- test/json_gem/
|
294
|
+
- test/json_gem/json_generator_test.rb
|
299
295
|
- test/json_gem/json_parser_test.rb
|
300
|
-
- test/
|
301
|
-
- test/
|
302
|
-
- test/
|
303
|
-
- test/
|
304
|
-
- test/
|
305
|
-
- test/
|
306
|
-
- test/
|
307
|
-
- test/bar.rb
|
308
|
-
- test/activesupport4/encoding_test.rb
|
296
|
+
- test/json_gem/json_encoding_test.rb
|
297
|
+
- test/json_gem/json_common_interface_test.rb
|
298
|
+
- test/json_gem/json_generic_object_test.rb
|
299
|
+
- test/json_gem/json_ext_parser_test.rb
|
300
|
+
- test/json_gem/json_fixtures_test.rb
|
301
|
+
- test/tests_mimic_addition.rb
|
302
|
+
- test/test_wab.rb
|
309
303
|
- test/activesupport4/test_helper.rb
|
310
304
|
- test/activesupport4/decoding_test.rb
|
311
|
-
- test/
|
305
|
+
- test/activesupport4/encoding_test.rb
|
306
|
+
- test/activerecord/result_test.rb
|
307
|
+
- test/_test_active.rb
|
308
|
+
- test/test_file.rb
|
312
309
|
- test/activesupport5/encoding_test_cases.rb
|
313
|
-
- test/activesupport5/encoding_test.rb
|
314
310
|
- test/activesupport5/time_zone_test_helpers.rb
|
315
311
|
- test/activesupport5/test_helper.rb
|
316
312
|
- test/activesupport5/decoding_test.rb
|
317
|
-
- test/
|
318
|
-
- test/
|
319
|
-
- test/test_wab.rb
|
320
|
-
- test/test_null.rb
|
321
|
-
- test/_test_active.rb
|
322
|
-
- test/_test_mimic_rails.rb
|
323
|
-
- test/test_fast.rb
|
324
|
-
- test/perf_fast.rb
|
325
|
-
- test/sample/change.rb
|
326
|
-
- test/sample/text.rb
|
327
|
-
- test/sample/doc.rb
|
328
|
-
- test/sample/shape.rb
|
329
|
-
- test/sample/layer.rb
|
330
|
-
- test/sample/group.rb
|
331
|
-
- test/sample/file.rb
|
332
|
-
- test/sample/rect.rb
|
333
|
-
- test/sample/hasprops.rb
|
334
|
-
- test/sample/line.rb
|
335
|
-
- test/sample/dir.rb
|
336
|
-
- test/sample/oval.rb
|
337
|
-
- test/tests_mimic.rb
|
338
|
-
- test/perf_simple.rb
|
339
|
-
- test/activerecord/result_test.rb
|
313
|
+
- test/activesupport5/encoding_test.rb
|
314
|
+
- test/tests.rb
|
340
315
|
- test/_test_active_mimic.rb
|
341
|
-
- test/
|
342
|
-
- test/
|
343
|
-
- test/
|
316
|
+
- test/perf_object.rb
|
317
|
+
- test/test_strict.rb
|
318
|
+
- test/test_scp.rb
|
319
|
+
- test/perf_wab.rb
|
320
|
+
- test/test_saj.rb
|
321
|
+
- test/mem.rb
|
322
|
+
- test/perf_compat.rb
|
323
|
+
- test/helper.rb
|
324
|
+
- test/isolated/test_mimic_alone.rb
|
344
325
|
- test/isolated/test_mimic_define.rb
|
345
|
-
- test/isolated/test_mimic_after.rb
|
346
326
|
- test/isolated/test_mimic_rails_after.rb
|
347
|
-
- test/isolated/
|
327
|
+
- test/isolated/test_mimic_after.rb
|
348
328
|
- test/isolated/test_mimic_rails_before.rb
|
329
|
+
- test/isolated/test_mimic_as_json.rb
|
349
330
|
- test/isolated/test_mimic_redefine.rb
|
350
331
|
- test/isolated/shared.rb
|
351
|
-
- test/isolated/
|
352
|
-
- test/
|
332
|
+
- test/isolated/test_mimic_before.rb
|
333
|
+
- test/sample_json.rb
|
353
334
|
- test/test_debian.rb
|
354
|
-
- test/
|
335
|
+
- test/perf_fast.rb
|
336
|
+
- test/test_writer.rb
|
337
|
+
- test/test_fast.rb
|
338
|
+
- test/sample/line.rb
|
339
|
+
- test/sample/change.rb
|
340
|
+
- test/sample/dir.rb
|
341
|
+
- test/sample/text.rb
|
342
|
+
- test/sample/layer.rb
|
343
|
+
- test/sample/rect.rb
|
344
|
+
- test/sample/group.rb
|
345
|
+
- test/sample/oval.rb
|
346
|
+
- test/sample/doc.rb
|
347
|
+
- test/sample/hasprops.rb
|
348
|
+
- test/sample/shape.rb
|
349
|
+
- test/sample/file.rb
|
355
350
|
- test/files.rb
|
351
|
+
- test/big.rb
|
352
|
+
- test/perf_saj.rb
|
353
|
+
- test/foo.rb
|
354
|
+
- test/tests_mimic.rb
|
355
|
+
- test/perf_strict.rb
|
356
356
|
- test/test_various.rb
|
357
|
+
- test/_test_mimic_rails.rb
|
358
|
+
- test/perf_simple.rb
|
data/test/bar.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
$: << File.dirname(__FILE__)
|
5
|
-
$oj_dir = File.dirname(File.expand_path(File.dirname(__FILE__)))
|
6
|
-
%w(lib ext).each do |dir|
|
7
|
-
$: << File.join($oj_dir, dir)
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'oj'
|
11
|
-
require 'tracer'
|
12
|
-
|
13
|
-
#Tracer.on
|
14
|
-
|
15
|
-
Oj.load_file(ARGV[0], mode: :strict) { |obj|
|
16
|
-
puts Oj.dump(obj, indent: 2)
|
17
|
-
}
|