oj 1.4.6 → 1.4.7
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.
- data/README.md +2 -4
- data/ext/oj/dump.c +2 -1
- data/lib/oj/version.rb +1 -1
- data/test/tests.rb +3 -7
- metadata +2 -2
data/README.md
CHANGED
@@ -32,11 +32,9 @@ A fast JSON parser and Object marshaller as a Ruby gem.
|
|
32
32
|
|
33
33
|
## <a name="release">Release Notes</a>
|
34
34
|
|
35
|
-
### Release 1.4.
|
35
|
+
### Release 1.4.7
|
36
36
|
|
37
|
-
-
|
38
|
-
|
39
|
-
- Now works with JRuby 1.7.0 to the extent possible with the unsupported C extension in JRuby.
|
37
|
+
- In compat mode non-String keys are converted to Strings instead of raising and error. (issue #52)
|
40
38
|
|
41
39
|
## <a name="description">Description</a>
|
42
40
|
|
data/ext/oj/dump.c
CHANGED
@@ -760,7 +760,8 @@ hash_cb_compat(VALUE key, VALUE value, Out out) {
|
|
760
760
|
dump_sym_comp(key, out);
|
761
761
|
break;
|
762
762
|
default:
|
763
|
-
rb_raise(rb_eTypeError, "In :compat mode all Hash keys must be Strings or Symbols, not %s.\n", rb_class2name(rb_obj_class(key)))
|
763
|
+
/*rb_raise(rb_eTypeError, "In :compat mode all Hash keys must be Strings or Symbols, not %s.\n", rb_class2name(rb_obj_class(key)));*/
|
764
|
+
dump_str_comp(rb_funcall(key, oj_to_s_id, 0), out);
|
764
765
|
break;
|
765
766
|
}
|
766
767
|
if (0 == out->opts->dump_opts) {
|
data/lib/oj/version.rb
CHANGED
data/test/tests.rb
CHANGED
@@ -374,13 +374,9 @@ class Juice < ::Test::Unit::TestCase
|
|
374
374
|
end
|
375
375
|
end
|
376
376
|
def test_non_str_hash_compat
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
rescue Exception => e
|
381
|
-
assert(e.message.include?('Fixnum'))
|
382
|
-
assert(true)
|
383
|
-
end
|
377
|
+
json = Oj.dump({ 1 => true, 0 => false }, :mode => :compat)
|
378
|
+
h = Oj.load(json, :mode => :strict)
|
379
|
+
assert_equal({ "1" => true, "0" => false }, h)
|
384
380
|
end
|
385
381
|
def test_non_str_hash_object
|
386
382
|
Oj.default_options = { :mode => :object }
|
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: 1.4.
|
4
|
+
version: 1.4.7
|
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: 2012-12-
|
12
|
+
date: 2012-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'The fastest JSON parser and object serializer. '
|
15
15
|
email: peter@ohler.com
|