oj 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oj might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a372edadce1968a9ad2d8f63e6a3ddb59f7452a9
4
- data.tar.gz: 7fde017753c41e55117a5959d20ca5cb42bad830
3
+ metadata.gz: 220d1012a368e139d601519ae2bde0835b574a44
4
+ data.tar.gz: e792b43ad00c9d8c592221e136b433d2ac1525cf
5
5
  SHA512:
6
- metadata.gz: 4024b5e1a5e33530cf5a714c62495bb06fc88225ae169ec429ac409b7f552637ffdcdfcb6f7d806a7fc4bc24d459ab8585d8f149044d7efb1eca23fc8320734b
7
- data.tar.gz: 880b75ee95588c1da932492cdf0ae086f63061dc3ced0c87fe544a068e3b3f32de7b4c91c9c3a94da19b26843b629fe6a1757e2a10ad89b12c433dc326a8e601
6
+ metadata.gz: 105d031b3ed97c598a828537304adbd344c43aafaf1a79793cdabe51823a6a1d3a1bb7aafce6022ffa732f355141a4061ca6f8bc33dc00b9be584ad5baf51270
7
+ data.tar.gz: 3ff635338d57dd897511bbabe746fcde5db77629f8ffd10d4441f1e81e5a24a22ff64f386cd6da0e8410d3c25fc504b4fffb29f57a313339eb9daa6397abcf9a
data/README.md CHANGED
@@ -20,13 +20,13 @@ Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announceme
20
20
 
21
21
  [![Build Status](https://secure.travis-ci.org/ohler55/oj.png?branch=master)](http://travis-ci.org/ohler55/oj)
22
22
 
23
- ### Current Release 2.5.0
23
+ ### Current Release 2.5.2
24
24
 
25
- - Added push_json() to the StringWriter and StreamWriter to allow raw JSON to be added to a JSON document being constructed.
25
+ - Fixed indent problem with StringWriter so it now indents properly
26
26
 
27
- ### Current Release 2.4.3
27
+ ### Current Release 2.5.1
28
28
 
29
- - Made include pthread.h conditional for Windows.
29
+ - Added push_json() to the StringWriter and StreamWriter to allow raw JSON to be added to a JSON document being constructed.
30
30
 
31
31
  [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
32
32
 
@@ -2078,7 +2078,9 @@ oj_str_writer_push_object(StrWriter sw, const char *key) {
2078
2078
  grow(&sw->out, size);
2079
2079
  }
2080
2080
  maybe_comma(sw);
2081
- fill_indent(&sw->out, sw->depth);
2081
+ if (0 < sw->depth) {
2082
+ fill_indent(&sw->out, sw->depth);
2083
+ }
2082
2084
  if (0 != key) {
2083
2085
  dump_cstr(key, strlen(key), 0, 0, &sw->out);
2084
2086
  *sw->out.cur++ = ':';
@@ -2097,6 +2099,9 @@ oj_str_writer_push_array(StrWriter sw, const char *key) {
2097
2099
  grow(&sw->out, size);
2098
2100
  }
2099
2101
  maybe_comma(sw);
2102
+ if (0 < sw->depth) {
2103
+ fill_indent(&sw->out, sw->depth);
2104
+ }
2100
2105
  if (0 != key) {
2101
2106
  dump_cstr(key, strlen(key), 0, 0, &sw->out);
2102
2107
  *sw->out.cur++ = ':';
@@ -2115,6 +2120,9 @@ oj_str_writer_push_value(StrWriter sw, VALUE val, const char *key) {
2115
2120
  grow(&sw->out, size);
2116
2121
  }
2117
2122
  maybe_comma(sw);
2123
+ if (0 < sw->depth) {
2124
+ fill_indent(&sw->out, sw->depth);
2125
+ }
2118
2126
  if (0 != key) {
2119
2127
  dump_cstr(key, strlen(key), 0, 0, &sw->out);
2120
2128
  *sw->out.cur++ = ':';
@@ -2132,6 +2140,9 @@ oj_str_writer_push_json(StrWriter sw, const char *json, const char *key) {
2132
2140
  grow(&sw->out, size);
2133
2141
  }
2134
2142
  maybe_comma(sw);
2143
+ if (0 < sw->depth) {
2144
+ fill_indent(&sw->out, sw->depth);
2145
+ }
2135
2146
  if (0 != key) {
2136
2147
  dump_cstr(key, strlen(key), 0, 0, &sw->out);
2137
2148
  *sw->out.cur++ = ':';
@@ -2163,6 +2174,9 @@ oj_str_writer_pop(StrWriter sw) {
2163
2174
  *sw->out.cur++ = ']';
2164
2175
  break;
2165
2176
  }
2177
+ if (0 == sw->depth && 0 < sw->out.indent) {
2178
+ *sw->out.cur++ = '\n';
2179
+ }
2166
2180
  }
2167
2181
 
2168
2182
  void
@@ -866,6 +866,7 @@ str_writer_init(StrWriter sw) {
866
866
  sw->out.hash_cnt = 0;
867
867
  sw->out.opts = &sw->opts;
868
868
  sw->out.indent = sw->opts.indent;
869
+ sw->out.depth = 0;
869
870
  }
870
871
 
871
872
  /* call-seq: new(options)
@@ -881,6 +882,8 @@ str_writer_new(int argc, VALUE *argv, VALUE self) {
881
882
  if (1 == argc) {
882
883
  oj_parse_options(argv[0], &sw->opts);
883
884
  }
885
+ sw->out.indent = sw->opts.indent;
886
+
884
887
  return Data_Wrap_Struct(oj_string_writer_class, 0, str_writer_free, sw);
885
888
  }
886
889
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.5.1'
4
+ VERSION = '2.5.2'
5
5
  end
@@ -63,7 +63,7 @@ class OjWriter < ::Test::Unit::TestCase
63
63
  end
64
64
 
65
65
  def test_string_writer_value_array
66
- w = Oj::StringWriter.new(:indent => 0)
66
+ w = Oj::StringWriter.new(:indent => 2)
67
67
  w.push_array()
68
68
  w.push_value(7)
69
69
  w.push_value(7.3)
@@ -73,7 +73,21 @@ class OjWriter < ::Test::Unit::TestCase
73
73
  w.push_value({'a' => 65})
74
74
  w.push_value([1,2])
75
75
  w.pop()
76
- assert_equal('[7,7.3,true,null,"a string",{"a":65},[1,2]]', w.to_s)
76
+ assert_equal(%|[
77
+ 7,
78
+ 7.3,
79
+ true,
80
+ null,
81
+ "a string",
82
+ {
83
+ "a":65
84
+ },
85
+ [
86
+ 1,
87
+ 2
88
+ ]
89
+ ]
90
+ |, w.to_s)
77
91
  end
78
92
 
79
93
  def test_string_writer_json
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: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'The fastest JSON parser and object serializer. '
14
14
  email: peter@ohler.com
@@ -18,42 +18,44 @@ extensions:
18
18
  extra_rdoc_files:
19
19
  - README.md
20
20
  files:
21
- - lib/oj/bag.rb
22
- - lib/oj/error.rb
23
- - lib/oj/mimic.rb
24
- - lib/oj/saj.rb
25
- - lib/oj/schandler.rb
26
- - lib/oj/version.rb
27
- - lib/oj.rb
28
- - ext/oj/extconf.rb
21
+ - LICENSE
22
+ - README.md
29
23
  - ext/oj/buf.h
30
- - ext/oj/cache8.h
31
- - ext/oj/circarray.h
32
- - ext/oj/encode.h
33
- - ext/oj/err.h
34
- - ext/oj/hash.h
35
- - ext/oj/odd.h
36
- - ext/oj/oj.h
37
- - ext/oj/parse.h
38
- - ext/oj/resolve.h
39
- - ext/oj/val_stack.h
40
24
  - ext/oj/cache8.c
25
+ - ext/oj/cache8.h
41
26
  - ext/oj/circarray.c
27
+ - ext/oj/circarray.h
42
28
  - ext/oj/compat.c
43
29
  - ext/oj/dump.c
30
+ - ext/oj/encode.h
44
31
  - ext/oj/err.c
32
+ - ext/oj/err.h
33
+ - ext/oj/extconf.rb
45
34
  - ext/oj/fast.c
46
35
  - ext/oj/hash.c
36
+ - ext/oj/hash.h
47
37
  - ext/oj/hash_test.c
48
38
  - ext/oj/object.c
49
39
  - ext/oj/odd.c
40
+ - ext/oj/odd.h
50
41
  - ext/oj/oj.c
42
+ - ext/oj/oj.h
51
43
  - ext/oj/parse.c
44
+ - ext/oj/parse.h
52
45
  - ext/oj/resolve.c
46
+ - ext/oj/resolve.h
53
47
  - ext/oj/saj.c
54
48
  - ext/oj/scp.c
55
49
  - ext/oj/strict.c
56
50
  - ext/oj/val_stack.c
51
+ - ext/oj/val_stack.h
52
+ - lib/oj.rb
53
+ - lib/oj/bag.rb
54
+ - lib/oj/error.rb
55
+ - lib/oj/mimic.rb
56
+ - lib/oj/saj.rb
57
+ - lib/oj/schandler.rb
58
+ - lib/oj/version.rb
57
59
  - test/a.rb
58
60
  - test/bug.rb
59
61
  - test/debian_test.rb
@@ -70,6 +72,7 @@ files:
70
72
  - test/perf_scp.rb
71
73
  - test/perf_simple.rb
72
74
  - test/perf_strict.rb
75
+ - test/sample.rb
73
76
  - test/sample/change.rb
74
77
  - test/sample/dir.rb
75
78
  - test/sample/doc.rb
@@ -82,7 +85,6 @@ files:
82
85
  - test/sample/rect.rb
83
86
  - test/sample/shape.rb
84
87
  - test/sample/text.rb
85
- - test/sample.rb
86
88
  - test/sample_json.rb
87
89
  - test/struct.rb
88
90
  - test/test_compat.rb
@@ -97,8 +99,6 @@ files:
97
99
  - test/test_writer.rb
98
100
  - test/tests.rb
99
101
  - test/x.rb
100
- - LICENSE
101
- - README.md
102
102
  homepage: http://www.ohler.com/oj
103
103
  licenses:
104
104
  - MIT
@@ -106,24 +106,24 @@ licenses:
106
106
  metadata: {}
107
107
  post_install_message:
108
108
  rdoc_options:
109
- - --main
109
+ - "--main"
110
110
  - README.md
111
111
  require_paths:
112
112
  - lib
113
113
  - ext
114
114
  required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>='
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project: oj
126
- rubygems_version: 2.0.3
126
+ rubygems_version: 2.2.0
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: A fast JSON parser and serializer.