canon 0.3.24 → 0.3.25
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/lib/canon/json_parsing.rb +10 -5
- data/lib/canon/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 542f29d833d2a2b08ebf8121b9bf847e4d30bfb2f86127742aad93ef648b8ab0
|
|
4
|
+
data.tar.gz: 3d16c5ef20e3b540969c21d185d345a6b4fc6e6c0c548811d9af87d6d1105490
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83d9046ae33bf10605fd636fa9606aaeb481633c12a374046451cd44988f24c9e022257a85441e4d10babc3a0d01957597313cf02fc6373bee43566ed4af76d9
|
|
7
|
+
data.tar.gz: d286b0b4358c9ef2a86930ae43fb356cb98a0f475affb6f76cae2140f36145fd440851b481d859af2a7a7ba996033d0719547102d09160a596af610d800301c9
|
data/lib/canon/json_parsing.rb
CHANGED
|
@@ -4,9 +4,10 @@ require "json"
|
|
|
4
4
|
|
|
5
5
|
module Canon
|
|
6
6
|
# The only place canon talks to a JSON engine. The yeptris fast path
|
|
7
|
-
# (fused C-API materializer
|
|
8
|
-
#
|
|
9
|
-
# the native materializer the stdlib parser
|
|
7
|
+
# (fused C-API materializer) engages through Yeptris::JSON.load —
|
|
8
|
+
# the strict JSON surface pinned to exact JSON.parse semantics
|
|
9
|
+
# upstream; without the native materializer the stdlib parser
|
|
10
|
+
# serves, unchanged.
|
|
10
11
|
# Errors normalize to JSON::ParserError so canon's rescues hold on
|
|
11
12
|
# both engines.
|
|
12
13
|
module JsonParsing
|
|
@@ -15,8 +16,12 @@ module Canon
|
|
|
15
16
|
def parse(json)
|
|
16
17
|
if Canon::YamlBackend.yeptris_native?
|
|
17
18
|
begin
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
# The strict JSON surface — spec-pinned to exact JSON.parse
|
|
20
|
+
# semantics upstream, deliberately separate from the YAML
|
|
21
|
+
# (Psych-contract) surface, which applies the YAML 1.1 quirk
|
|
22
|
+
# table to JSON-shaped input.
|
|
23
|
+
::Yeptris::JSON.load(json)
|
|
24
|
+
rescue ::Yeptris::JSON::ParseError, ::Yeptris::ParseError => e
|
|
20
25
|
raise JSON::ParserError, e.message
|
|
21
26
|
end
|
|
22
27
|
else
|
data/lib/canon/version.rb
CHANGED