oj 2.15.0 → 2.15.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,6 +25,11 @@ puts "Same? #{h == h2}"
25
25
  # true
26
26
  ```
27
27
 
28
+ By default Oj uses the :object mode which is used to marshal and unmarshal Ruby
29
+ objects. Deserialize arbitrary JSON in object mode may lead to unexpected
30
+ results. :compat mode is a better choice for rails and :strict mode is a better
31
+ choice for general JSON parsing. See the options section below for details.
32
+
28
33
  ## Installation
29
34
  ```
30
35
  gem install oj
@@ -48,7 +53,7 @@ converted to JSON. These modes are set with the `:mode` option in either the
48
53
  default options or as one of the options to the `dump` method. In addition to
49
54
  the various options there are also alternative APIs for parsing JSON.
50
55
 
51
- The fastest alternaive parser API is the `Oj::Doc` API. The `Oj::Doc` API takes
56
+ The fastest alternative parser API is the `Oj::Doc` API. The `Oj::Doc` API takes
52
57
  a completely different approach by opening a JSON document and providing calls
53
58
  to navigate around the JSON while it is open. With this approach, JSON access
54
59
  can be well over 20 times faster than conventional JSON parsing.
@@ -165,18 +170,9 @@ Oj.default_options = {:mode => :compat }
165
170
 
166
171
  ## Releases
167
172
 
168
- ** Release 2.15.0**
169
-
170
- - Fixed bug where encoded strings could be GCed.
171
-
172
- - :nan option added for dumping Infinity, -Infinity, and NaN. This is an
173
- edition to the API. The default value for the :non option is :auto which uses
174
- the previous NaN handling on dumping of non-object modes.
175
-
176
- **Release 2.14.7**
173
+ **Release 2.15.1**
177
174
 
178
- - Fixed bug where a comment before another JSON element caused an
179
- error. Comments are not part of the spec but this keep support consistent.
175
+ - Fixed bug with activerecord when to_json returns an array instead of a string.
180
176
 
181
177
  [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
182
178
 
@@ -1432,8 +1432,9 @@ dump_obj_comp(VALUE obj, int depth, Out out, int argc, VALUE *argv) {
1432
1432
 
1433
1433
  //rb_raise(rb_eTypeError, "%s.to_hash() did not return a Hash.\n", rb_class2name(rb_obj_class(obj)));
1434
1434
  dump_val(h, depth, out, 0, 0);
1435
+ } else {
1436
+ dump_hash(h, Qundef, depth, out->opts->mode, out);
1435
1437
  }
1436
- dump_hash(h, Qundef, depth, out->opts->mode, out);
1437
1438
  } else if (rb_respond_to(obj, oj_as_json_id)) {
1438
1439
  volatile VALUE aj = rb_funcall2(obj, oj_as_json_id, argc, argv);
1439
1440
 
@@ -2010,6 +2011,9 @@ dump_val(VALUE obj, int depth, Out out, int argc, VALUE *argv) {
2010
2011
  if (MAX_DEPTH < depth) {
2011
2012
  rb_raise(rb_eNoMemError, "Too deeply nested.\n");
2012
2013
  }
2014
+ #ifdef OJ_DEBUG
2015
+ printf("Oj-debug: dump_val %s\n", rb_class2name(rb_obj_class(obj)));
2016
+ #endif
2013
2017
  switch (type) {
2014
2018
  case T_NIL: dump_nil(out); break;
2015
2019
  case T_TRUE: dump_true(out); break;
@@ -48,6 +48,8 @@ else
48
48
  dflags['NEEDS_STPCPY'] = nil if is_windows
49
49
  end
50
50
 
51
+ dflags['OJ_DEBUG'] = true unless ENV['OJ_DEBUG'].nil?
52
+
51
53
  dflags.each do |k,v|
52
54
  if v.nil?
53
55
  $CPPFLAGS += " -D#{k}"
@@ -55,6 +57,7 @@ dflags.each do |k,v|
55
57
  $CPPFLAGS += " -D#{k}=#{v}"
56
58
  end
57
59
  end
60
+
58
61
  $CPPFLAGS += ' -Wall'
59
62
  #puts "*** $CPPFLAGS: #{$CPPFLAGS}"
60
63
  create_makefile("#{extension_name}/#{extension_name}")
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.15.0'
4
+ VERSION = '2.15.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.0
4
+ version: 2.15.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-28 00:00:00.000000000 Z
12
+ date: 2016-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler