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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5be5bacbb4459129b1e489146ef79efa7b23c48ebaf1f41e53709625f7cef0c7
4
- data.tar.gz: 4d8080d605d1dd3750f2a95d2f17fedc0262ffe73438690f6f1b6e66d3511cf9
3
+ metadata.gz: 1500b32611dd205778d21f8175a6e587c85d8090e9861c6ab5c2bbdc8cc7b107
4
+ data.tar.gz: 7bccf2b0c350f282b152f0e85addedb62d596c83a5347afa4205bb025f1dd24f
5
5
  SHA512:
6
- metadata.gz: c30ac0e64c2ec2d2a677aba6c5eb50618bd7e33873a8b367339f2f25d2e76875cc8d01651e8f6df6a9b0814a75df8021b68b6fe181a34c46737ddc887f8e3c8f
7
- data.tar.gz: 83b459d7b7c20602c772dbb323159fccde46eff4ef43d6773614941ee0e4eee8bdb39926702ce91f523821ce1e9a4efa49c4e63121d503e20a59788588dfc8a6
6
+ metadata.gz: cf52a3ae9060dcebbc0febfde70aba86d718dd0545eb55da4f25e7fffa3bacbaff82e56656c189f6d7ffd25093c9a5967085864ce1db921dcb0e9cc92c9b299f
7
+ data.tar.gz: 55d5e7da5ff1dee20b3a48e08d7a8e389fe8cd4a1f6569ca84d0a59f0e84085fb5af3e2a6721f76ea7dfd860bdbdc8844e7464572191be0c816bf0522036edd0
data/CHANGES.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Changes
2
2
 
3
- * Numerous performance optimizations in `JSON.generate` and `JSON.dump`.
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`.
@@ -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.dup
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.dup
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSON
4
- VERSION = '2.7.3.rc1'
4
+ VERSION = '2.7.3'
5
5
  end
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.rc1
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-23 00:00:00.000000000 Z
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.17
88
+ rubygems_version: 3.5.11
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: JSON Implementation for Ruby