oj 3.0.0 → 3.0.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/oj/dump.h +0 -4
- data/ext/oj/dump_leaf.c +3 -5
- data/ext/oj/oj.c +0 -1
- data/ext/oj/string_writer.c +1 -1
- data/lib/oj/version.rb +1 -1
- data/test/test_compat.rb +1 -1
- data/test/test_fast.rb +9 -5
- data/test/test_file.rb +3 -1
- data/test/tests.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f17a28bd292a74d89703b466aa07ccbcf4ff8b1e
|
4
|
+
data.tar.gz: 5b38dfb5e07d744a9ef61615088a56c2f2d3d097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f34961546d44387a7dcdab7e033a154e3dbd6660b4679ad83c3b2bbc378f8b2e2e69007042459b38fa5968dfe9253898a0ac1d85845b1522a6a90c9438d098f
|
7
|
+
data.tar.gz: 9ea1e4b3afc0077240e71b16a111ce1dd238fcaaf2a1e84597c0a60a5d32171c60e4812f2c4164e454fedd6029f85cf66874a76ff021780c28c9bc12d052f678
|
data/README.md
CHANGED
@@ -63,7 +63,7 @@ See [{file:CHANGELOG.md}](CHANGELOG.md)
|
|
63
63
|
|
64
64
|
## Links
|
65
65
|
|
66
|
-
- *Documentation*: http://www.ohler.com/oj, http://rubydoc.info/gems/oj
|
66
|
+
- *Documentation*: http://www.ohler.com/oj/doc, http://rubydoc.info/gems/oj
|
67
67
|
|
68
68
|
- *GitHub* *repo*: https://github.com/ohler55/oj
|
69
69
|
|
data/ext/oj/dump.h
CHANGED
@@ -47,10 +47,6 @@ extern void oj_dump_custom_val(VALUE obj, int depth, Out out, bool as_ok);
|
|
47
47
|
extern VALUE oj_add_to_json(int argc, VALUE *argv, VALUE self);
|
48
48
|
extern VALUE oj_remove_to_json(int argc, VALUE *argv, VALUE self);
|
49
49
|
|
50
|
-
// TBD remove when refactor complete
|
51
|
-
extern void oj_dump_comp_val(VALUE obj, int depth, Out out, int argc, VALUE *argv, bool as_ok);
|
52
|
-
|
53
|
-
|
54
50
|
inline static void
|
55
51
|
assure_size(Out out, size_t len) {
|
56
52
|
if (out->end - out->cur <= (long)len) {
|
data/ext/oj/dump_leaf.c
CHANGED
@@ -10,8 +10,6 @@
|
|
10
10
|
|
11
11
|
static void dump_leaf(Leaf leaf, int depth, Out out);
|
12
12
|
|
13
|
-
extern void dump_cstr(const char *str, size_t cnt, int is_sym, int escape1, Out out);
|
14
|
-
|
15
13
|
static void
|
16
14
|
grow(Out out, size_t len) {
|
17
15
|
size_t size = out->end - out->buf;
|
@@ -52,10 +50,10 @@ static void
|
|
52
50
|
dump_leaf_str(Leaf leaf, Out out) {
|
53
51
|
switch (leaf->value_type) {
|
54
52
|
case STR_VAL:
|
55
|
-
|
53
|
+
oj_dump_cstr(leaf->str, strlen(leaf->str), 0, 0, out);
|
56
54
|
break;
|
57
55
|
case RUBY_VAL:
|
58
|
-
|
56
|
+
oj_dump_cstr(rb_string_value_cstr(&leaf->value), RSTRING_LEN(leaf->value), 0, 0, out);
|
59
57
|
break;
|
60
58
|
case COL_VAL:
|
61
59
|
default:
|
@@ -160,7 +158,7 @@ dump_leaf_hash(Leaf leaf, int depth, Out out) {
|
|
160
158
|
grow(out, size);
|
161
159
|
}
|
162
160
|
fill_indent(out, d2);
|
163
|
-
|
161
|
+
oj_dump_cstr(e->key, strlen(e->key), 0, 0, out);
|
164
162
|
*out->cur++ = ':';
|
165
163
|
dump_leaf(e, d2, out);
|
166
164
|
if (e->next != first) {
|
data/ext/oj/oj.c
CHANGED
data/ext/oj/string_writer.c
CHANGED
data/lib/oj/version.rb
CHANGED
data/test/test_compat.rb
CHANGED
@@ -257,7 +257,7 @@ class CompatJuice < Minitest::Test
|
|
257
257
|
# BigDecimals are dumped as strings and can not be restored to the
|
258
258
|
# original value.
|
259
259
|
json = Oj.dump(BigDecimal.new('3.14159265358979323846'))
|
260
|
-
if RUBY_VERSION
|
260
|
+
if RUBY_VERSION >= '2.4.0'
|
261
261
|
# 2.4.0 changes the exponent to lowercase
|
262
262
|
assert_equal('"0.314159265358979323846e1"', json)
|
263
263
|
else
|
data/test/test_fast.rb
CHANGED
@@ -33,7 +33,7 @@ class DocTest < Minitest::Test
|
|
33
33
|
json = %{null}
|
34
34
|
Oj::Doc.open(json) do |doc|
|
35
35
|
assert_equal(NilClass, doc.type)
|
36
|
-
|
36
|
+
assert_nil(doc.fetch())
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -80,7 +80,7 @@ class DocTest < Minitest::Test
|
|
80
80
|
def test_fixnum
|
81
81
|
json = %{12345}
|
82
82
|
Oj::Doc.open(json) do |doc|
|
83
|
-
assert_equal(
|
83
|
+
assert_equal(Integer, doc.type)
|
84
84
|
assert_equal(12345, doc.fetch())
|
85
85
|
end
|
86
86
|
end
|
@@ -209,10 +209,10 @@ class DocTest < Minitest::Test
|
|
209
209
|
[['/', Hash],
|
210
210
|
['/array', Array],
|
211
211
|
['/array/1', Hash],
|
212
|
-
['/array/1/num',
|
212
|
+
['/array/1/num', Integer],
|
213
213
|
['/array/1/string', String],
|
214
214
|
['/array/1/hash/h2/a', Array],
|
215
|
-
['/array/1/hash/../num',
|
215
|
+
['/array/1/hash/../num', Integer],
|
216
216
|
['/array/1/hash/../..', Array],
|
217
217
|
].each do |path,type|
|
218
218
|
assert_equal(type, doc.type(path))
|
@@ -233,7 +233,11 @@ class DocTest < Minitest::Test
|
|
233
233
|
['/array/1/hash/../..', 'array'],
|
234
234
|
].each do |path,key|
|
235
235
|
doc.move(path)
|
236
|
-
|
236
|
+
if key.nil?
|
237
|
+
assert_nil(doc.local_key())
|
238
|
+
else
|
239
|
+
assert_equal(key, doc.local_key())
|
240
|
+
end
|
237
241
|
end
|
238
242
|
end
|
239
243
|
end
|
data/test/test_file.rb
CHANGED
@@ -145,7 +145,7 @@ class FileJuice < Minitest::Test
|
|
145
145
|
|
146
146
|
# Object with to_json()
|
147
147
|
def test_json_object_compat
|
148
|
-
Oj.default_options = { :mode => :compat, :use_to_json => true }
|
148
|
+
Oj.default_options = { :mode => :compat, :use_to_json => true, :create_additions => true }
|
149
149
|
obj = Jeez.new(true, 58)
|
150
150
|
json = Oj.dump(obj, :indent => 2)
|
151
151
|
assert(%{{"json_class":"FileJuice::Jeez","x":true,"y":58}
|
@@ -228,6 +228,8 @@ class FileJuice < Minitest::Test
|
|
228
228
|
end
|
229
229
|
assert_equal(obj.utc?, loaded.utc?)
|
230
230
|
assert_equal(obj.utc_offset, loaded.utc_offset)
|
231
|
+
elsif obj.nil?
|
232
|
+
assert_nil(loaded)
|
231
233
|
else
|
232
234
|
assert_equal(obj, loaded)
|
233
235
|
end
|
data/test/tests.rb
CHANGED
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.0.
|
4
|
+
version: 3.0.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: 2017-04-
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|