oj 3.11.0 → 3.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/oj/mimic_json.c +1 -0
- data/ext/oj/oj.c +8 -0
- data/lib/oj/version.rb +1 -1
- data/test/helper.rb +10 -0
- data/test/json_gem/json_generator_test.rb +15 -3
- data/test/json_gem/test_helper.rb +8 -0
- data/test/test_compat.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 698d68ef4c5a05318046700568e3d19c9d5e40644950c76cf02d31490a4bd738
|
4
|
+
data.tar.gz: 1cff670f6587f0080108980d339f9c8cff3097bb5e7cf67a2c583e8745385b7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cfb98a97ead48a89f95af28dc364633199afb5cbe269ba07b90a26eabe77d9e59c1051731e07ff3821233bdf10d54896c2e9821786dfee2140beaac9dc8c0d2
|
7
|
+
data.tar.gz: 79173558b0cc6e4cb9852c32e7949d88396ffbb8f34cc7781f6144ade5c7ecf5cf8b24a374056ee50e8367d96ba79510cf8ba21a19acd8e52a61c8c731b44921
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [![{}j](http://www.ohler.com/dev/images/oj_comet_64.svg)](http://www.ohler.com/oj) gem
|
2
2
|
|
3
|
-
[![Build Status](https://img.shields.io/travis/ohler55/oj/master.svg?logo=travis)](http://travis-ci.org/ohler55/oj?branch=master)
|
3
|
+
[![Build Status](https://img.shields.io/travis/ohler55/oj/master.svg?logo=travis)](http://travis-ci.org/ohler55/oj?branch=master) ![Gem](https://img.shields.io/gem/v/oj.svg) ![Gem](https://img.shields.io/gem/dt/oj.svg) [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=oj&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=oj&package-manager=bundler&version-scheme=semver) [![TideLift](https://tidelift.com/badges/github/ohler55/oj)](https://tidelift.com/subscription/pkg/rubygems-oj?utm_source=rubygems-oj&utm_medium=referral&utm_campaign=readme)
|
4
4
|
|
5
5
|
A *fast* JSON parser and Object marshaller as a Ruby gem.
|
6
6
|
|
data/ext/oj/mimic_json.c
CHANGED
@@ -841,6 +841,7 @@ oj_mimic_json_methods(VALUE json) {
|
|
841
841
|
}
|
842
842
|
// Pull in the JSON::State mimic file.
|
843
843
|
state_class = rb_const_get_at(generator, rb_intern("State"));
|
844
|
+
rb_gc_register_mark_object(state_class);
|
844
845
|
|
845
846
|
symbolize_names_sym = ID2SYM(rb_intern("symbolize_names")); rb_gc_register_address(&symbolize_names_sym);
|
846
847
|
}
|
data/ext/oj/oj.c
CHANGED
@@ -1649,13 +1649,21 @@ Init_oj() {
|
|
1649
1649
|
rb_require("oj/schandler");
|
1650
1650
|
|
1651
1651
|
oj_bag_class = rb_const_get_at(Oj, rb_intern("Bag"));
|
1652
|
+
rb_gc_register_mark_object(oj_bag_class);
|
1652
1653
|
oj_bigdecimal_class = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
|
1654
|
+
rb_gc_register_mark_object(oj_bigdecimal_class);
|
1653
1655
|
oj_date_class = rb_const_get(rb_cObject, rb_intern("Date"));
|
1656
|
+
rb_gc_register_mark_object(oj_date_class);
|
1654
1657
|
oj_datetime_class = rb_const_get(rb_cObject, rb_intern("DateTime"));
|
1658
|
+
rb_gc_register_mark_object(oj_datetime_class);
|
1655
1659
|
oj_enumerable_class = rb_const_get(rb_cObject, rb_intern("Enumerable"));
|
1660
|
+
rb_gc_register_mark_object(oj_enumerable_class);
|
1656
1661
|
oj_parse_error_class = rb_const_get_at(Oj, rb_intern("ParseError"));
|
1662
|
+
rb_gc_register_mark_object(oj_parse_error_class);
|
1657
1663
|
oj_stringio_class = rb_const_get(rb_cObject, rb_intern("StringIO"));
|
1664
|
+
rb_gc_register_mark_object(oj_stringio_class);
|
1658
1665
|
oj_struct_class = rb_const_get(rb_cObject, rb_intern("Struct"));
|
1666
|
+
rb_gc_register_mark_object(oj_struct_class);
|
1659
1667
|
oj_json_parser_error_class = rb_eEncodingError; // replaced if mimic is called
|
1660
1668
|
oj_json_generator_error_class = rb_eEncodingError; // replaced if mimic is called
|
1661
1669
|
|
data/lib/oj/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
1
3
|
# Ubuntu does not accept arguments to ruby when called using env. To get warnings to show up the -w options is
|
2
4
|
# required. That can be set in the RUBYOPT environment variable.
|
3
5
|
# export RUBYOPT=-w
|
@@ -16,6 +18,14 @@ require 'bigdecimal'
|
|
16
18
|
require 'pp'
|
17
19
|
require 'oj'
|
18
20
|
|
21
|
+
|
22
|
+
if defined?(GC.verify_compaction_references) == 'method'
|
23
|
+
# This method was added in Ruby 3.0.0. Calling it this way asks the GC to
|
24
|
+
# move objects around, helping to find object movement bugs.
|
25
|
+
GC.verify_compaction_references(double_heap: true, toward: :empty)
|
26
|
+
end
|
27
|
+
|
28
|
+
|
19
29
|
$ruby = RUBY_DESCRIPTION.split(' ')[0]
|
20
30
|
$ruby = 'ree' if 'ruby' == $ruby && RUBY_DESCRIPTION.include?('Ruby Enterprise Edition')
|
21
31
|
|
@@ -136,6 +136,10 @@ EOT
|
|
136
136
|
|
137
137
|
def test_pretty_state
|
138
138
|
state = JSON::PRETTY_STATE_PROTOTYPE.dup
|
139
|
+
# In come cases in Ruby 3.0 an :escape_slash is included in the state. It
|
140
|
+
# seems to occur on travis but not locally.
|
141
|
+
actual = state.to_h
|
142
|
+
actual.delete(:escape_slash)
|
139
143
|
assert_equal({
|
140
144
|
:allow_nan => false,
|
141
145
|
:array_nl => "\n",
|
@@ -147,11 +151,15 @@ EOT
|
|
147
151
|
:object_nl => "\n",
|
148
152
|
:space => " ",
|
149
153
|
:space_before => "",
|
150
|
-
}.sort_by { |n,| n.to_s },
|
154
|
+
}.sort_by { |n,| n.to_s }, actual.sort_by { |n,| n.to_s })
|
151
155
|
end
|
152
156
|
|
153
157
|
def test_safe_state
|
154
158
|
state = JSON::SAFE_STATE_PROTOTYPE.dup
|
159
|
+
# In come cases in Ruby 3.0 an :escape_slash is included in the state. It
|
160
|
+
# seems to occur on travis but not locally.
|
161
|
+
actual = state.to_h
|
162
|
+
actual.delete(:escape_slash)
|
155
163
|
assert_equal({
|
156
164
|
:allow_nan => false,
|
157
165
|
:array_nl => "",
|
@@ -163,11 +171,15 @@ EOT
|
|
163
171
|
:object_nl => "",
|
164
172
|
:space => "",
|
165
173
|
:space_before => "",
|
166
|
-
}.sort_by { |n,| n.to_s },
|
174
|
+
}.sort_by { |n,| n.to_s }, actual.sort_by { |n,| n.to_s })
|
167
175
|
end
|
168
176
|
|
169
177
|
def test_fast_state
|
170
178
|
state = JSON::FAST_STATE_PROTOTYPE.dup
|
179
|
+
# In come cases in Ruby 3.0 an :escape_slash is included in the state. It
|
180
|
+
# seems to occur on travis but not locally.
|
181
|
+
actual = state.to_h
|
182
|
+
actual.delete(:escape_slash)
|
171
183
|
assert_equal({
|
172
184
|
:allow_nan => false,
|
173
185
|
:array_nl => "",
|
@@ -179,7 +191,7 @@ EOT
|
|
179
191
|
:object_nl => "",
|
180
192
|
:space => "",
|
181
193
|
:space_before => "",
|
182
|
-
}.sort_by { |n,| n.to_s },
|
194
|
+
}.sort_by { |n,| n.to_s }, actual.sort_by { |n,| n.to_s })
|
183
195
|
end
|
184
196
|
|
185
197
|
def test_allow_nan
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
$: << File.dirname(__FILE__)
|
2
4
|
$oj_dir = File.dirname(File.dirname(File.expand_path(File.dirname(__FILE__))))
|
3
5
|
%w(lib ext).each do |dir|
|
@@ -12,6 +14,12 @@ if ENV['REAL_JSON_GEM']
|
|
12
14
|
else
|
13
15
|
require 'oj'
|
14
16
|
Oj.mimic_JSON
|
17
|
+
|
18
|
+
if defined?(GC.verify_compaction_references) == 'method'
|
19
|
+
# This method was added in Ruby 3.0.0. Calling it this way asks the GC to
|
20
|
+
# move objects around, helping to find object movement bugs.
|
21
|
+
GC.verify_compaction_references(double_heap: true, toward: :empty)
|
22
|
+
end
|
15
23
|
end
|
16
24
|
|
17
25
|
NaN = JSON::NaN if defined?(JSON::NaN)
|
data/test/test_compat.rb
CHANGED
@@ -178,7 +178,7 @@ class CompatJuice < Minitest::Test
|
|
178
178
|
assert_equal('"abc"', json)
|
179
179
|
end
|
180
180
|
|
181
|
-
def
|
181
|
+
def test_time_xml_schema
|
182
182
|
t = Time.xmlschema("2012-01-05T23:58:07.123456000+09:00")
|
183
183
|
#t = Time.local(2012, 1, 5, 23, 58, 7, 123456)
|
184
184
|
json = Oj.dump(t, :mode => :compat)
|
@@ -297,7 +297,7 @@ class CompatJuice < Minitest::Test
|
|
297
297
|
end
|
298
298
|
|
299
299
|
# Time
|
300
|
-
def
|
300
|
+
def test_time_from_time_object
|
301
301
|
t = Time.new(2015, 1, 5, 21, 37, 7.123456, -8 * 3600)
|
302
302
|
expect = '"' + t.to_s + '"'
|
303
303
|
json = Oj.dump(t)
|
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: 3.11.
|
4
|
+
version: 3.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|