smarter_json 1.2.0 → 1.2.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/smarter_json/parser.rb +12 -3
- data/lib/smarter_json/version.rb +1 -1
- 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: f66007af9616269be4ccc22a5e73d784bc9991dbb5c4245e5cef15293cbc7ab8
|
|
4
|
+
data.tar.gz: d95cecb5d4258d44ed104c8386281e60855e196e09ed5c05e47e5ebe70b4e100
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4924b4a88250124b30a4d97b99d9c84ea644b922c4a0dea4fb4dfb185638b7fb43ccce2b638026d1b52d085fe7e5fceb94168edb190133684de0d94ab90f0399
|
|
7
|
+
data.tar.gz: 6c8493f8b1808deab9a7f039c9394c12d51076c4b670ad04df4c0b8b32d1deadfa1549d79cb2eb3200a3c2291cd652b255c061e4b210acc2426a3673a0cc33c3
|
data/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
> ⚠️ We discourage the use of `process(input).first` / `process(input)[0]` because it silently drops potential additional documents
|
|
14
14
|
> Please use `process_one` if you are expecting only one JSON doc, e.g. in API payloads, because it emits on_warning if it finds multiple docs.
|
|
15
15
|
|
|
16
|
+
## 1.2.1 (2026-06-17)
|
|
17
|
+
|
|
18
|
+
RSpec tests: 1,165
|
|
19
|
+
|
|
20
|
+
- Performance improvements
|
|
21
|
+
|
|
16
22
|
## 1.2.0 (2026-06-16)
|
|
17
23
|
|
|
18
24
|
RSpec tests: 1,097 → 1,165
|
data/lib/smarter_json/parser.rb
CHANGED
|
@@ -757,8 +757,10 @@ module SmarterJSON
|
|
|
757
757
|
# incl. LF/CR which also terminate). Stopping at a terminator/EOF means the run had no
|
|
758
758
|
# interior whitespace, so there's nothing to trim and no comment marker can apply.
|
|
759
759
|
#
|
|
760
|
-
# U+FEFF is JSON5/ES5 whitespace but
|
|
761
|
-
|
|
760
|
+
# U+FEFF is JSON5/ES5 whitespace but NOT in [[:space:]]. It is deliberately kept OUT of
|
|
761
|
+
# this regex: a multibyte alternative defeats byteindex's fast byte-search (~3.3x slower
|
|
762
|
+
# on number-dense input). A trailing U+FEFF is trimmed cheaply in the fast path below.
|
|
763
|
+
QL_BREAK = /[,{}\[\]]|[[:space:]]/.freeze
|
|
762
764
|
|
|
763
765
|
# The defaults live centrally in SmarterJSON::Options (lib/smarter_json/options.rb).
|
|
764
766
|
DEFAULT_OPTIONS = Options::DEFAULT_OPTIONS
|
|
@@ -1350,7 +1352,14 @@ module SmarterJSON
|
|
|
1350
1352
|
b = hit < @bytesize ? input.getbyte(hit) : nil
|
|
1351
1353
|
if b.nil? || b == COMMA || b == RBRACE || b == RBRACKET || b == LBRACE || b == LBRACKET || b == LF || b == CR
|
|
1352
1354
|
@pos = hit
|
|
1353
|
-
|
|
1355
|
+
# A trailing U+FEFF (EF BB BF) is JSON5/ES5 whitespace but not in QL_BREAK, so
|
|
1356
|
+
# byteindex scanned past it into the run — trim it (and a run of them). On the
|
|
1357
|
+
# common path the last byte is a digit/letter, so the first compare fails at once.
|
|
1358
|
+
fin = hit
|
|
1359
|
+
while fin - 3 >= pos && input.getbyte(fin - 1) == 0xBF && input.getbyte(fin - 2) == 0xBB && input.getbyte(fin - 3) == 0xEF
|
|
1360
|
+
fin -= 3
|
|
1361
|
+
end
|
|
1362
|
+
return fin
|
|
1354
1363
|
end
|
|
1355
1364
|
end
|
|
1356
1365
|
|
data/lib/smarter_json/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smarter_json
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tilo Sloboda
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-06-
|
|
10
|
+
date: 2026-06-17 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: bigdecimal
|