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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b5e26434d67518ead10da0ffb7f97ca0d05a0de
4
- data.tar.gz: cdd5a57251a116ba7e7f1d16136821a5baa04869
3
+ metadata.gz: f17a28bd292a74d89703b466aa07ccbcf4ff8b1e
4
+ data.tar.gz: 5b38dfb5e07d744a9ef61615088a56c2f2d3d097
5
5
  SHA512:
6
- metadata.gz: 1a9ab31bbf01cd8794e88a25adcbb989dead17ac17c76ea792d0580211e516f67b9224aaa64e85af62b1ba5a1a230693c6e14415443f33e04f683e2e0cb632f0
7
- data.tar.gz: 6656a40ec3b1aea8de039062f76f00124c0af96e4679df3975c97e495ced5aa5811f628304ec23c52baa17b18780eee6f2705cd9dedc23e75626e733e3777872
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
 
@@ -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) {
@@ -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
- dump_cstr(leaf->str, strlen(leaf->str), 0, 0, out);
53
+ oj_dump_cstr(leaf->str, strlen(leaf->str), 0, 0, out);
56
54
  break;
57
55
  case RUBY_VAL:
58
- dump_cstr(rb_string_value_cstr(&leaf->value), RSTRING_LEN(leaf->value), 0, 0, out);
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
- dump_cstr(e->key, strlen(e->key), 0, 0, out);
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) {
@@ -953,7 +953,6 @@ dump(int argc, VALUE *argv, VALUE self) {
953
953
  oj_parse_options(argv[1], &copts);
954
954
  }
955
955
  if (CompatMode == copts.mode) {
956
- copts.to_json = No;
957
956
  copts.dump_opts.nan_dump = true;
958
957
  }
959
958
  out.buf = buf;
@@ -157,7 +157,7 @@ oj_str_writer_push_value(StrWriter sw, VALUE val, const char *key) {
157
157
  *sw->out.cur++ = ':';
158
158
  }
159
159
  }
160
- oj_dump_comp_val(val, sw->depth, &sw->out, 0, 0, true);
160
+ oj_dump_custom_val(val, sw->depth, &sw->out, true);
161
161
  }
162
162
 
163
163
  void
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
@@ -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 == '2.4.0'
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
@@ -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
- assert_equal(nil, doc.fetch())
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(Fixnum, doc.type)
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', Fixnum],
212
+ ['/array/1/num', Integer],
213
213
  ['/array/1/string', String],
214
214
  ['/array/1/hash/h2/a', Array],
215
- ['/array/1/hash/../num', Fixnum],
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
- assert_equal(key, doc.local_key())
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
@@ -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
@@ -12,3 +12,10 @@ require 'test_null'
12
12
  require 'test_compat'
13
13
  require 'test_object'
14
14
  require 'test_custom'
15
+ require 'test_writer'
16
+ require 'test_fast'
17
+ require 'test_hash'
18
+ require 'test_file'
19
+ require 'test_gc'
20
+ require 'test_saj'
21
+ require 'test_scp'
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.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-24 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler