json 2.0.4-java → 2.1.0-java
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.
Potentially problematic release.
This version of json might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/json/ext/generator.jar +0 -0
- data/lib/json/ext/parser.jar +0 -0
- data/lib/json/pure/parser.rb +5 -1
- data/lib/json/version.rb +1 -1
- data/tests/json_encoding_test.rb +2 -2
- data/tests/json_parser_test.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 634b7c9d77f51f54770f912bce42e4a6765ad87f
|
4
|
+
data.tar.gz: 67189aeb4ed037c326096522f03d5455d875c5e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f4402403159951b48a71ae16f990e5a273f89bd249d27d8fc1b965c2017de88480941e3d3f73bb068e5f4e7a91f05dcd46f077f3149c26acada386752e7d796
|
7
|
+
data.tar.gz: '082bde17c11b76f51ae1fd60df8dd72bdee08c31aae7495d436f1a12d0c2f5b29c028ac2e151921ae8cbe0a027f135a21dd703fea39243dfd5cdfb2667ba2fbd'
|
data/lib/json/ext/generator.jar
CHANGED
Binary file
|
data/lib/json/ext/parser.jar
CHANGED
Binary file
|
data/lib/json/pure/parser.rb
CHANGED
@@ -70,6 +70,9 @@ module JSON
|
|
70
70
|
# option defaults to false.
|
71
71
|
# * *object_class*: Defaults to Hash
|
72
72
|
# * *array_class*: Defaults to Array
|
73
|
+
# * *decimal_class*: Specifies which class to use instead of the default
|
74
|
+
# (Float) when parsing decimal numbers. This class must accept a single
|
75
|
+
# string argument in its constructor.
|
73
76
|
def initialize(source, opts = {})
|
74
77
|
opts ||= {}
|
75
78
|
source = convert_encoding source
|
@@ -94,6 +97,7 @@ module JSON
|
|
94
97
|
@create_id = @create_additions ? JSON.create_id : nil
|
95
98
|
@object_class = opts[:object_class] || Hash
|
96
99
|
@array_class = opts[:array_class] || Array
|
100
|
+
@decimal_class = opts[:decimal_class]
|
97
101
|
@match_string = opts[:match_string]
|
98
102
|
end
|
99
103
|
|
@@ -193,7 +197,7 @@ module JSON
|
|
193
197
|
def parse_value
|
194
198
|
case
|
195
199
|
when scan(FLOAT)
|
196
|
-
Float(self[1])
|
200
|
+
@decimal_class && @decimal_class.new(self[1]) || Float(self[1])
|
197
201
|
when scan(INTEGER)
|
198
202
|
Integer(self[1])
|
199
203
|
when scan(TRUE)
|
data/lib/json/version.rb
CHANGED
data/tests/json_encoding_test.rb
CHANGED
@@ -79,8 +79,8 @@ class JSONEncodingTest < Test::Unit::TestCase
|
|
79
79
|
json = '["\ud840\udc01"]'
|
80
80
|
assert_equal json, generate(utf8, :ascii_only => true)
|
81
81
|
assert_equal utf8, parse(json)
|
82
|
-
|
83
|
-
|
82
|
+
assert_raise(JSON::ParserError) { parse('"\u"') }
|
83
|
+
assert_raise(JSON::ParserError) { parse('"\ud800"') }
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_chars
|
data/tests/json_parser_test.rb
CHANGED
@@ -108,6 +108,11 @@ class JSONParserTest < Test::Unit::TestCase
|
|
108
108
|
assert_equal -1.0/0, parse('-Infinity', :allow_nan => true)
|
109
109
|
end
|
110
110
|
|
111
|
+
def test_parse_bigdecimals
|
112
|
+
assert_equal(BigDecimal, JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"].class)
|
113
|
+
assert_equal(BigDecimal.new("0.901234567890123456789E1"),JSON.parse('{"foo": 9.01234567890123456789}', decimal_class: BigDecimal)["foo"] )
|
114
|
+
end
|
115
|
+
|
111
116
|
if Array.method_defined?(:permutation)
|
112
117
|
def test_parse_more_complex_arrays
|
113
118
|
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Daniel Luz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|