oj 3.6.11 → 3.6.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/ext/oj/string_writer.c +2 -0
- data/lib/oj/version.rb +1 -1
- data/test/foo.rb +8 -49
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3517ed09e956844a399f8986027f8990949bb7702c9e88a5b4fa4f2fc9d4eb07
|
4
|
+
data.tar.gz: 16292809c8dced3cfd7dd6cfb110d85c88256d74c08586e4c436f92cab8888dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc24329317395830e448ec06373ff27458c33612ce6fec0b4a79515c63f43164afb82a093cdbae7a6d6244885f2df16da0fba449c63b283af814769b4ed78147
|
7
|
+
data.tar.gz: 10ff64b0f48d1962c26f213e92456de839b65ab595c2925890a1eabd590160be355674bde197e0d65f4de4e1c9d246c1ce1c12f1adedc3c2aca967b3fd339390
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [![{}j](http://www.ohler.com/dev/images/oj_comet_64.svg)](http://www.ohler.com/oj) gem
|
2
2
|
|
3
|
-
[![Build Status](https://img.shields.io/travis/ohler55/oj/master.svg)](http://travis-ci.org/ohler55/oj?branch=master) [![AppVeyor](https://img.shields.io/appveyor/ci/ohler55/oj/master.svg)](https://ci.appveyor.com/project/ohler55/oj) ![Gem](https://img.shields.io/gem/v/oj.svg) ![Gem](https://img.shields.io/gem/dt/oj.svg) [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=oj&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=oj&package-manager=bundler&version-scheme=semver)
|
3
|
+
[![Build Status](https://img.shields.io/travis/ohler55/oj/master.svg)](http://travis-ci.org/ohler55/oj?branch=master) [![AppVeyor](https://img.shields.io/appveyor/ci/ohler55/oj/master.svg)](https://ci.appveyor.com/project/ohler55/oj) ![Gem](https://img.shields.io/gem/v/oj.svg) ![Gem](https://img.shields.io/gem/dt/oj.svg) [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=oj&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=oj&package-manager=bundler&version-scheme=semver) [![TideLift](https://tidelift.com/badges/github/ohler55/oj)](https://tidelift.com/subscription/pkg/rubygems-oj?utm_source=rubygems-oj&utm_medium=referral&utm_campaign=readme)
|
4
4
|
|
5
5
|
A *fast* JSON parser and Object marshaller as a Ruby gem.
|
6
6
|
|
@@ -40,6 +40,10 @@ or in Bundler:
|
|
40
40
|
gem 'oj'
|
41
41
|
```
|
42
42
|
|
43
|
+
## Support
|
44
|
+
|
45
|
+
[Get supported Oj with a Tidelift Subscription.](https://tidelift.com/subscription/pkg/rubygems-oj?utm_source=rubygems-oj&utm_medium=referral&utm_campaign=readme)
|
46
|
+
|
43
47
|
## Further Reading
|
44
48
|
|
45
49
|
For more details on options, modes, advanced features, and more follow these
|
data/ext/oj/string_writer.c
CHANGED
@@ -66,6 +66,7 @@ oj_str_writer_init(StrWriter sw, int buf_size) {
|
|
66
66
|
sw->out.allocated = true;
|
67
67
|
sw->out.cur = sw->out.buf;
|
68
68
|
*sw->out.cur = '\0';
|
69
|
+
sw->out.circ_cache = NULL;
|
69
70
|
sw->out.circ_cnt = 0;
|
70
71
|
sw->out.hash_cnt = 0;
|
71
72
|
sw->out.opts = &sw->opts;
|
@@ -75,6 +76,7 @@ oj_str_writer_init(StrWriter sw, int buf_size) {
|
|
75
76
|
sw->out.argv = NULL;
|
76
77
|
sw->out.caller = 0;
|
77
78
|
sw->out.ropts = NULL;
|
79
|
+
sw->out.omit_nil = oj_default_options.dump_opts.omit_nil;
|
78
80
|
}
|
79
81
|
|
80
82
|
void
|
data/lib/oj/version.rb
CHANGED
data/test/foo.rb
CHANGED
@@ -6,53 +6,12 @@ $: << '../ext'
|
|
6
6
|
|
7
7
|
require 'oj'
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
10.times {
|
10
|
+
io = StringIO.new
|
11
|
+
w = Oj::StreamWriter.new(io)
|
12
|
+
w.push_array
|
13
|
+
child = {"id"=>"1", "name"=>"foo", "nilElement"=>nil}
|
14
|
+
w.push_value(child)
|
15
|
+
puts io.string
|
16
|
+
}
|
11
17
|
|
12
|
-
def expect(a,b)
|
13
|
-
puts "*** #{a} != #{b}" unless a == b
|
14
|
-
end
|
15
|
-
|
16
|
-
def dig(obj, *path)
|
17
|
-
return obj if path.empty?
|
18
|
-
|
19
|
-
if obj.is_a?(Array)
|
20
|
-
obj.each { |v|
|
21
|
-
r = dig(v, *path)
|
22
|
-
return r unless r.nil?
|
23
|
-
}
|
24
|
-
end
|
25
|
-
return nil unless obj.is_a?(Hash)
|
26
|
-
|
27
|
-
dig(obj[path[0]], *path[1..-1])
|
28
|
-
end
|
29
|
-
|
30
|
-
1000.times do |i|
|
31
|
-
Oj::Doc.open(json) do |doc|
|
32
|
-
# this always passes
|
33
|
-
doc.each_child('/aggregations/hashtags/buckets') do |bucket|
|
34
|
-
expect(bucket.fetch('key'), 'foo')
|
35
|
-
expect(bucket.fetch('count'), 100)
|
36
|
-
end
|
37
|
-
|
38
|
-
# load any other json using Oj.load
|
39
|
-
# this will pass
|
40
|
-
other = Oj.load(json)
|
41
|
-
dig(other, 'aggregations', 'hashtags', 'buckets').each do |bucket|
|
42
|
-
expect(bucket.fetch('key'), 'foo')
|
43
|
-
expect(bucket.fetch('count'), 100)
|
44
|
-
end
|
45
|
-
GC.start
|
46
|
-
doc.each_child('/aggregations/hashtags/buckets') do |bucket|
|
47
|
-
# This is where it fails!!!! It will be some other object (even an rspec matcher in some cases)
|
48
|
-
expect(bucket.fetch('key'), 'foo')
|
49
|
-
expect(bucket.fetch('count'), 100)
|
50
|
-
end
|
51
|
-
|
52
|
-
# this always passes if it gets this far
|
53
|
-
dig(other, 'aggregations', 'hashtags', 'buckets').each do |bucket|
|
54
|
-
expect(bucket.fetch('key'), 'foo')
|
55
|
-
expect(bucket.fetch('count'), 100)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
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.6.
|
4
|
+
version: 3.6.12
|
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-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|