oj 3.11.2 → 3.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oj/oj.c +1 -1
- data/lib/oj/easy_hash.rb +5 -4
- data/lib/oj/version.rb +1 -1
- data/test/test_hash.rb +10 -0
- 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: ac386a7ea62cf364370a1800bb9e96a05a66a0631681efbf5e8efda33a328a08
|
4
|
+
data.tar.gz: 8aa230bfdc9fb73c191eb826464ad47a7fdcc8018f57c7ab17227f511364a204
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7344b60e4e26f9418e32692bc961bacb0cc9e519856d8a6ebd7211ba3d2f768040bc299654581f8e09b95015b9e35099eef1e984f03229c0148f22d130374c3b
|
7
|
+
data.tar.gz: 48bbf893276a31dd93eda88a0a0d874c979d4a70e0c6b80c0ca5360be4b8bf2cc6281c27694d5fb991608164c9e7c33e2d982ba21b20b1f1a4b954567722206f
|
data/ext/oj/oj.c
CHANGED
@@ -223,7 +223,7 @@ struct _options oj_default_options = {
|
|
223
223
|
*
|
224
224
|
* Returns the default load and dump options as a Hash. The options are
|
225
225
|
* - *:indent* [_Fixnum_|_String_|_nil_] number of spaces to indent each element in an JSON document, zero or nil is no newline between JSON elements, negative indicates no newline between top level JSON elements in a stream, a String indicates the string should be used for indentation
|
226
|
-
* - *:circular* [_Boolean_|_nil_] support circular references while dumping
|
226
|
+
* - *:circular* [_Boolean_|_nil_] support circular references while dumping as well as shared references
|
227
227
|
* - *:auto_define* [_Boolean_|_nil_] automatically define classes if they do not exist
|
228
228
|
* - *:symbol_keys* [_Boolean_|_nil_] use symbols instead of strings for hash keys
|
229
229
|
* - *:escape_mode* [_:newline_|_:json_|_:xss_safe_|_:ascii_|_unicode_xss_|_nil_] determines the characters to escape
|
data/lib/oj/easy_hash.rb
CHANGED
@@ -12,13 +12,14 @@ module Oj
|
|
12
12
|
|
13
13
|
# Replaces the Object.respond_to?() method.
|
14
14
|
# @param [Symbol] m method symbol
|
15
|
+
# @param [Boolean] include_all whether to include private and protected methods in the search
|
15
16
|
# @return [Boolean] true for any method that matches an instance
|
16
17
|
# variable reader, otherwise false.
|
17
|
-
def respond_to?(m)
|
18
|
+
def respond_to?(m, include_all = false)
|
18
19
|
return true if super
|
19
|
-
return true if has_key?(
|
20
|
-
return true if has_key?(
|
21
|
-
has_key?(
|
20
|
+
return true if has_key?(m)
|
21
|
+
return true if has_key?(m.to_s)
|
22
|
+
has_key?(m.to_sym)
|
22
23
|
end
|
23
24
|
|
24
25
|
def [](key)
|
data/lib/oj/version.rb
CHANGED
data/test/test_hash.rb
CHANGED
@@ -25,5 +25,15 @@ class Hashi < Minitest::Test
|
|
25
25
|
assert_equal(3, obj[:abc])
|
26
26
|
assert_equal(3, obj.abc())
|
27
27
|
end
|
28
|
+
|
29
|
+
def test_marshal
|
30
|
+
h = Oj::EasyHash.new()
|
31
|
+
h['abc'] = 3
|
32
|
+
out = Marshal.dump(h)
|
33
|
+
|
34
|
+
obj = Marshal.load(out)
|
35
|
+
assert_equal(Oj::EasyHash, obj.class)
|
36
|
+
assert_equal(3, obj[:abc])
|
37
|
+
end
|
28
38
|
|
29
39
|
end # HashTest
|
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.3
|
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-
|
11
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|