oj 2.17.1 → 2.17.2

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: 442b44efad229257aca6e661d9007d3fdc6ff06c
4
- data.tar.gz: 66e9485846bccc6c5059e22417d1af5c091b20cc
3
+ metadata.gz: fda157680e8bdefb8ada5e768266c624ec23e190
4
+ data.tar.gz: 4b19f21033006a9e652be232bbcd7bce56b7f8cf
5
5
  SHA512:
6
- metadata.gz: 1f8f5fcbe94843dc1e8cd1a8868afd2d4cb0ad29c701869deaab1a56353d087f64cc460f2e9ecd46482ec46d9ab918eccd6cd66b30950eb380c32b58ca214681
7
- data.tar.gz: d3fda284959163b69fae190c7ee0e92a52d93a7160bf363caf5fa17e5e848b50d8f2bd7675e7bb8091cf625fc64faab33fb039bc00311cd4a8e8c969a687d6cf
6
+ metadata.gz: a61a6aa2f2f1a6c22dc20628fa19519c381eaffcde90e39c1fbb366861cfd7cc06e81ec972dd18d0e08d07805bbaf3c187332a64d28575b51f72eb3c835fd7af
7
+ data.tar.gz: ca4a307de685a1d122cfe579ed551627a6e5b78c3045888d0fc1e3d3941d326bf0ec2eb0afa43adbe2ea62afb871eb30b62e68dc44ace762c6ac10273d29c73d
data/README.md CHANGED
@@ -170,21 +170,10 @@ Oj.default_options = {:mode => :compat }
170
170
 
171
171
  ## Releases
172
172
 
173
- **Release 2.17.1**
173
+ **Release 2.17.2**
174
174
 
175
- - Added an option provide an alternative Hash class for loading.
176
-
177
- - Added the Oj::EasyHash class.
178
-
179
- - Fixed test failures on 32 bit machines.
180
-
181
- - Sped up mimic_JSON.
182
-
183
- - Added an option to omit Hash and Object attributes with nil values.
184
-
185
- **Release 2.16.1**
186
-
187
- - Thanks to hsbt for fixing a compile issue with Ruby 2.4.0-preview1.
175
+ - Worked around a problem with DateTime and ActiveSupport that causes a hang
176
+ when hour, minute, second, and some other methods are called from C.
188
177
 
189
178
  [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
190
179
 
@@ -1981,7 +1981,7 @@ dump_odd(VALUE obj, Odd odd, VALUE clas, int depth, Out out) {
1981
1981
  char *n2 = nbuf;
1982
1982
  char *n;
1983
1983
  char *end;
1984
- ID i;
1984
+ ID i;
1985
1985
 
1986
1986
  if (sizeof(nbuf) <= nlen) {
1987
1987
  n2 = strdup(name);
@@ -3,7 +3,7 @@ require 'active_support/time'
3
3
 
4
4
  module Oj
5
5
 
6
- #
6
+ # Exists only to handle the ActiveSupport::TimeWithZone.
7
7
  class ActiveSupportHelper
8
8
 
9
9
  def self.createTimeWithZone(utc, zone)
@@ -15,3 +15,27 @@ end
15
15
 
16
16
  Oj.register_odd(ActiveSupport::TimeWithZone, Oj::ActiveSupportHelper, :createTimeWithZone, :utc, 'time_zone.name')
17
17
 
18
+ # This is a hack to work around an oddness with DateTime and the ActiveSupport
19
+ # that causes a hang when some methods are called from C. Hour, min(ute),
20
+ # sec(ond) and other methods are special but they can be called from C until
21
+ # activesupport/time is required. After that they can not be even though
22
+ # resond_to? returns true. By defining methods to call super the problem goes
23
+ # away. There is obviously some magic going on under the covers that I don't
24
+ # understand.
25
+ class DateTime
26
+ def hour()
27
+ super
28
+ end
29
+ def min()
30
+ super
31
+ end
32
+ def sec()
33
+ super
34
+ end
35
+ def sec_fraction()
36
+ super
37
+ end
38
+ def offset()
39
+ super
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.17.1'
4
+ VERSION = '2.17.2'
5
5
  end
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ $: << File.dirname(__FILE__)
5
+
6
+ require 'helper'
7
+
8
+ require "active_support" # v5.0.0
9
+ require "oj" #v2.17.1
10
+
11
+ puts "ActiveSupport + OJ.dump(DateTime.now)"
12
+ puts
13
+ puts Oj.dump(DateTime.now)
14
+ puts
15
+
16
+ require "oj/active_support_helper"
17
+ #require 'active_support/time'
18
+
19
+ puts "ActiveSupport + OJ + active_support_helper dump(DateTime.now)"
20
+ puts
21
+ puts Oj.dump(DateTime.now)
22
+ puts
23
+
@@ -175,7 +175,6 @@ class Juice < Minitest::Test
175
175
 
176
176
  def test_float_parse
177
177
  Oj.default_options = { :float_precision => 16, :bigdecimal_load => :auto }
178
- =begin
179
178
  n = Oj.load('0.00001234567890123456')
180
179
  assert_equal(Float, n.class)
181
180
  assert_equal('1.234567890123456e-05', "%0.15e" % [n])
@@ -183,15 +182,15 @@ class Juice < Minitest::Test
183
182
  n = Oj.load('-0.00001234567890123456')
184
183
  assert_equal(Float, n.class)
185
184
  assert_equal('-1.234567890123456e-05', "%0.15e" % [n])
186
- =end
185
+
187
186
  n = Oj.load('1000.0000123456789')
188
187
  assert_equal(BigDecimal, n.class)
189
188
  assert_equal('0.10000000123456789E4', n.to_s)
190
- =begin
189
+
191
190
  n = Oj.load('-0.000012345678901234567')
192
191
  assert_equal(BigDecimal, n.class)
193
192
  assert_equal('-0.12345678901234567E-4', n.to_s)
194
- =end
193
+
195
194
  end
196
195
 
197
196
  def test_float_dump
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.17.1
4
+ version: 2.17.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: 2016-07-08 00:00:00.000000000 Z
11
+ date: 2016-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -106,6 +106,7 @@ files:
106
106
  - test/_test_active.rb
107
107
  - test/_test_active_mimic.rb
108
108
  - test/_test_mimic_rails.rb
109
+ - test/activesupport_datetime_test.rb
109
110
  - test/bug.rb
110
111
  - test/bug2.rb
111
112
  - test/bug3.rb
@@ -195,6 +196,7 @@ test_files:
195
196
  - test/_test_active.rb
196
197
  - test/_test_active_mimic.rb
197
198
  - test/_test_mimic_rails.rb
199
+ - test/activesupport_datetime_test.rb
198
200
  - test/bug.rb
199
201
  - test/bug2.rb
200
202
  - test/bug3.rb