oj 3.7.12 → 3.8.1

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.
@@ -134,6 +134,7 @@ class Juice < Minitest::Test
134
134
  :use_to_json=>false,
135
135
  :use_to_hash=>false,
136
136
  :use_as_json=>false,
137
+ :use_raw_json=>false,
137
138
  :nilnil=>true,
138
139
  :empty_string=>true,
139
140
  :allow_gc=>false,
@@ -158,6 +159,7 @@ class Juice < Minitest::Test
158
159
  :array_class=>Array,
159
160
  :ignore=>nil,
160
161
  :trace=>true,
162
+ :safe=>true,
161
163
  }
162
164
  Oj.default_options = alt
163
165
  #keys = alt.keys
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #require 'json'
4
+
5
+ $: << File.dirname(__FILE__)
6
+ require 'helper'
7
+ require 'oj'
8
+
9
+ Oj.mimic_JSON
10
+ puts "\u3074"
11
+
12
+ puts JSON.dump(["\u3074"])
13
+ puts JSON.generate(["\u3074"])
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.12
4
+ version: 3.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-14 00:00:00.000000000 Z
11
+ date: 2019-07-22 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/Modes.md
82
+ - pages/Rails.md
83
+ - pages/JsonGem.md
84
+ - pages/Encoding.md
85
+ - pages/WAB.md
86
+ - pages/Custom.md
83
87
  - pages/Advanced.md
84
88
  - pages/Options.md
85
- - pages/Custom.md
86
89
  - pages/Compatibility.md
87
- - pages/WAB.md
90
+ - pages/Modes.md
88
91
  - 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
@@ -177,7 +177,7 @@ files:
177
177
  - test/activesupport5/encoding_test_cases.rb
178
178
  - test/activesupport5/test_helper.rb
179
179
  - test/activesupport5/time_zone_test_helpers.rb
180
- - test/big.rb
180
+ - test/bar.rb
181
181
  - test/files.rb
182
182
  - test/foo.rb
183
183
  - test/helper.rb
@@ -200,7 +200,6 @@ files:
200
200
  - test/json_gem/json_parser_test.rb
201
201
  - test/json_gem/json_string_matching_test.rb
202
202
  - test/json_gem/test_helper.rb
203
- - test/mem.rb
204
203
  - test/perf.rb
205
204
  - test/perf_compat.rb
206
205
  - test/perf_fast.rb
@@ -244,6 +243,7 @@ files:
244
243
  - test/tests.rb
245
244
  - test/tests_mimic.rb
246
245
  - test/tests_mimic_addition.rb
246
+ - test/zoo.rb
247
247
  homepage: http://www.ohler.com/oj
248
248
  licenses:
249
249
  - MIT
@@ -266,7 +266,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
266
  requirements:
267
267
  - - ">="
268
268
  - !ruby/object:Gem::Version
269
- version: '2.0'
269
+ version: '2.3'
270
270
  required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  requirements:
272
272
  - - ">="
@@ -278,82 +278,82 @@ signing_key:
278
278
  specification_version: 4
279
279
  summary: A fast JSON parser and serializer.
280
280
  test_files:
281
- - test/perf_file.rb
282
- - test/test_hash.rb
283
- - test/perf.rb
284
- - test/test_object.rb
285
- - test/test_null.rb
286
- - test/test_compat.rb
287
- - test/test_custom.rb
288
- - test/perf_scp.rb
281
+ - test/foo.rb
289
282
  - test/test_integer_range.rb
290
- - test/test_gc.rb
291
- - test/sample.rb
292
- - test/json_gem/json_string_matching_test.rb
283
+ - test/test_strict.rb
284
+ - test/perf_strict.rb
285
+ - test/tests.rb
286
+ - test/perf_saj.rb
287
+ - test/test_compat.rb
288
+ - test/helper.rb
289
+ - test/perf_file.rb
290
+ - test/test_scp.rb
291
+ - test/perf_compat.rb
292
+ - test/json_gem/json_common_interface_test.rb
293
293
  - test/json_gem/json_addition_test.rb
294
- - test/json_gem/test_helper.rb
294
+ - test/json_gem/json_fixtures_test.rb
295
+ - test/json_gem/json_ext_parser_test.rb
296
+ - test/json_gem/json_string_matching_test.rb
297
+ - test/json_gem/json_generic_object_test.rb
295
298
  - test/json_gem/json_generator_test.rb
296
- - test/json_gem/json_parser_test.rb
299
+ - test/json_gem/test_helper.rb
297
300
  - test/json_gem/json_encoding_test.rb
298
- - test/json_gem/json_common_interface_test.rb
299
- - test/json_gem/json_generic_object_test.rb
300
- - test/json_gem/json_ext_parser_test.rb
301
- - test/json_gem/json_fixtures_test.rb
302
- - test/tests_mimic_addition.rb
303
- - test/test_wab.rb
301
+ - test/json_gem/json_parser_test.rb
302
+ - test/perf_wab.rb
303
+ - test/test_file.rb
304
+ - test/test_object.rb
305
+ - test/sample.rb
306
+ - test/perf_object.rb
307
+ - test/test_hash.rb
308
+ - test/test_custom.rb
309
+ - test/bar.rb
310
+ - test/activesupport4/encoding_test.rb
304
311
  - test/activesupport4/test_helper.rb
305
312
  - test/activesupport4/decoding_test.rb
306
- - test/activesupport4/encoding_test.rb
307
- - test/activerecord/result_test.rb
308
- - test/_test_active.rb
309
- - test/test_file.rb
313
+ - test/sample_json.rb
310
314
  - test/activesupport5/encoding_test_cases.rb
315
+ - test/activesupport5/encoding_test.rb
311
316
  - test/activesupport5/time_zone_test_helpers.rb
312
317
  - test/activesupport5/test_helper.rb
313
318
  - test/activesupport5/decoding_test.rb
314
- - test/activesupport5/encoding_test.rb
315
- - test/tests.rb
316
- - test/_test_active_mimic.rb
317
- - test/perf_object.rb
318
- - test/test_strict.rb
319
- - test/test_scp.rb
320
- - test/perf_wab.rb
321
319
  - test/test_saj.rb
322
- - test/mem.rb
323
- - test/perf_compat.rb
324
- - test/helper.rb
325
- - test/isolated/test_mimic_alone.rb
326
- - test/isolated/test_mimic_define.rb
327
- - test/isolated/test_mimic_rails_after.rb
328
- - test/isolated/test_mimic_after.rb
329
- - test/isolated/test_mimic_rails_before.rb
330
- - test/isolated/test_mimic_as_json.rb
331
- - test/isolated/test_mimic_redefine.rb
332
- - test/isolated/shared.rb
333
- - test/isolated/test_mimic_before.rb
334
- - test/sample_json.rb
335
- - test/test_debian.rb
336
- - test/perf_fast.rb
337
- - test/test_writer.rb
320
+ - test/perf_scp.rb
321
+ - test/test_wab.rb
322
+ - test/test_null.rb
323
+ - test/_test_active.rb
324
+ - test/_test_mimic_rails.rb
338
325
  - test/test_fast.rb
339
- - test/sample/line.rb
326
+ - test/perf_fast.rb
340
327
  - test/sample/change.rb
341
- - test/sample/dir.rb
342
328
  - test/sample/text.rb
343
- - test/sample/layer.rb
344
- - test/sample/rect.rb
345
- - test/sample/group.rb
346
- - test/sample/oval.rb
347
329
  - test/sample/doc.rb
348
- - test/sample/hasprops.rb
349
330
  - test/sample/shape.rb
331
+ - test/sample/layer.rb
332
+ - test/sample/group.rb
350
333
  - test/sample/file.rb
351
- - test/files.rb
352
- - test/big.rb
353
- - test/perf_saj.rb
354
- - test/foo.rb
334
+ - test/sample/rect.rb
335
+ - test/sample/hasprops.rb
336
+ - test/sample/line.rb
337
+ - test/sample/dir.rb
338
+ - test/sample/oval.rb
355
339
  - test/tests_mimic.rb
356
- - test/perf_strict.rb
357
- - test/test_various.rb
358
- - test/_test_mimic_rails.rb
359
340
  - test/perf_simple.rb
341
+ - test/zoo.rb
342
+ - test/activerecord/result_test.rb
343
+ - test/_test_active_mimic.rb
344
+ - test/tests_mimic_addition.rb
345
+ - test/test_writer.rb
346
+ - test/perf.rb
347
+ - test/isolated/test_mimic_define.rb
348
+ - test/isolated/test_mimic_after.rb
349
+ - test/isolated/test_mimic_rails_after.rb
350
+ - test/isolated/test_mimic_before.rb
351
+ - test/isolated/test_mimic_rails_before.rb
352
+ - test/isolated/test_mimic_redefine.rb
353
+ - test/isolated/shared.rb
354
+ - test/isolated/test_mimic_alone.rb
355
+ - test/isolated/test_mimic_as_json.rb
356
+ - test/test_debian.rb
357
+ - test/test_gc.rb
358
+ - test/files.rb
359
+ - test/test_various.rb
@@ -1,15 +0,0 @@
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
-
@@ -1,35 +0,0 @@
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