json 2.7.3.rc1 → 2.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +3 -1
- data/lib/json/pure/generator.rb +4 -8
- data/lib/json/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1500b32611dd205778d21f8175a6e587c85d8090e9861c6ab5c2bbdc8cc7b107
|
4
|
+
data.tar.gz: 7bccf2b0c350f282b152f0e85addedb62d596c83a5347afa4205bb025f1dd24f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf52a3ae9060dcebbc0febfde70aba86d718dd0545eb55da4f25e7fffa3bacbaff82e56656c189f6d7ffd25093c9a5967085864ce1db921dcb0e9cc92c9b299f
|
7
|
+
data.tar.gz: 55d5e7da5ff1dee20b3a48e08d7a8e389fe8cd4a1f6569ca84d0a59f0e84085fb5af3e2a6721f76ea7dfd860bdbdc8844e7464572191be0c816bf0522036edd0
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
-
|
3
|
+
### 2024-10-24 (2.7.3)
|
4
|
+
|
5
|
+
* Numerous performance optimizations in `JSON.generate` and `JSON.dump` (up to 2 times faster).
|
4
6
|
* Limit the size of ParserError exception messages, only include up to 32 bytes of the unparseable source.
|
5
7
|
* Fix json-pure's `Object#to_json` to accept non state arguments
|
6
8
|
* Fix multiline comment support in `json-pure`.
|
data/lib/json/pure/generator.rb
CHANGED
@@ -50,8 +50,7 @@ module JSON
|
|
50
50
|
# Convert a UTF8 encoded Ruby string _string_ to a JSON string, encoded with
|
51
51
|
# UTF16 big endian characters as \u????, and return it.
|
52
52
|
def utf8_to_json(string, script_safe = false) # :nodoc:
|
53
|
-
string = string.
|
54
|
-
string.force_encoding(::Encoding::ASCII_8BIT)
|
53
|
+
string = string.b
|
55
54
|
if script_safe
|
56
55
|
string.gsub!(SCRIPT_SAFE_ESCAPE_PATTERN) { SCRIPT_SAFE_MAP[$&] || $& }
|
57
56
|
else
|
@@ -62,8 +61,7 @@ module JSON
|
|
62
61
|
end
|
63
62
|
|
64
63
|
def utf8_to_json_ascii(string, script_safe = false) # :nodoc:
|
65
|
-
string = string.
|
66
|
-
string.force_encoding(::Encoding::ASCII_8BIT)
|
64
|
+
string = string.b
|
67
65
|
map = script_safe ? SCRIPT_SAFE_MAP : MAP
|
68
66
|
string.gsub!(/[\/"\\\x0-\x1f]/n) { map[$&] || $& }
|
69
67
|
string.gsub!(/(
|
@@ -409,16 +407,14 @@ module JSON
|
|
409
407
|
|
410
408
|
def json_transform(state)
|
411
409
|
delim = ",#{state.object_nl}"
|
412
|
-
result = "{#{state.object_nl}"
|
413
|
-
result = result.dup if result.frozen? # RUBY_VERSION < 3.0
|
410
|
+
result = +"{#{state.object_nl}"
|
414
411
|
depth = state.depth += 1
|
415
412
|
first = true
|
416
413
|
indent = !state.object_nl.empty?
|
417
414
|
each { |key, value|
|
418
415
|
result << delim unless first
|
419
416
|
result << state.indent * depth if indent
|
420
|
-
result = "#{result}#{key.to_s.to_json(state)}#{state.space_before}:#{state.space}"
|
421
|
-
result = result.dup if result.frozen? # RUBY_VERSION < 3.0
|
417
|
+
result = +"#{result}#{key.to_s.to_json(state)}#{state.space_before}:#{state.space}"
|
422
418
|
if state.strict? && !(false == value || true == value || nil == value || String === value || Array === value || Hash === value || Integer === value || Float === value)
|
423
419
|
raise GeneratorError, "#{value.class} not allowed in JSON"
|
424
420
|
elsif value.respond_to?(:to_json)
|
data/lib/json/version.rb
CHANGED
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.7.3
|
4
|
+
version: 2.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a JSON implementation as a Ruby extension in C.
|
14
14
|
email: flori@ping.de
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.5.
|
88
|
+
rubygems_version: 3.5.11
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: JSON Implementation for Ruby
|