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 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.6
35
+ ### Release 1.4.7
36
36
 
37
- - Silently ignores BOM on files and Strings.
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
 
@@ -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) {
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '1.4.6'
4
+ VERSION = '1.4.7'
5
5
  end
@@ -374,13 +374,9 @@ class Juice < ::Test::Unit::TestCase
374
374
  end
375
375
  end
376
376
  def test_non_str_hash_compat
377
- begin
378
- Oj.dump({ 1 => true, 0 => false }, :mode => :compat)
379
- assert(false)
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.6
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-03 00:00:00.000000000 Z
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