canon 0.3.50 → 0.3.52
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/CLAUDE.md +1 -1
- data/lib/canon/comparison/yaml_comparator.rb +2 -2
- data/lib/canon/comparison.rb +1 -2
- data/lib/canon/formatters/yaml_formatter.rb +1 -1
- data/lib/canon/version.rb +1 -1
- data/lib/canon/yaml_parsing.rb +15 -0
- metadata +32 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e699f814a8d0944cf2cef44825a9d417302adf157a7672ee3d94974a372b8ade
|
|
4
|
+
data.tar.gz: ef0e376d61027009a26ba783cb71ab5bedf0efc947cfea7a2b465d5504b32597
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0ef1400915d857311938307896e5e276bf3fb56088f98716218d2d92d82429f0b5864f4e24ce35eb0a99d249ed04c862b948de6483269df9cd21879845827d2
|
|
7
|
+
data.tar.gz: 5d95e02de1d7eb031a15f41a5705414cebd8360fc9bbaec0b1f90a34b1fb0689d504c3c5f258b3de7b66d91951b2889e2ad5dbc1d75d3485eb6d5f15e8588114
|
data/CLAUDE.md
CHANGED
|
@@ -149,7 +149,7 @@ Engine A/B testing: `CANON_XML_BACKEND=nokogiri bundle exec rspec` (or `=moxml`
|
|
|
149
149
|
|
|
150
150
|
### YAML Engines
|
|
151
151
|
|
|
152
|
-
`Canon::YamlBackend` selects the YAML engine: `:yeptris` (default — Marshal bulk materialization in yeptris 0.1.28, 4.5–5x Psych load) or `:psych` (`CANON_YAML_BACKEND=psych` forces the stdlib engine). The default follows availability: yeptris when loadable, Psych otherwise. `Canon::YamlParsing` is the single gateway for string loads; `Canon::JsonParsing` mirrors it for JSON (the same yeptris engine serves both — `Yeptris::YAML.load` auto-detects JSON and routes to the native C-API materializer; JSON falls back to stdlib unless `YamlBackend.yeptris_native?`, since the FFI ladder is ~29x slower than the stdlib C extension).
|
|
152
|
+
`Canon::YamlBackend` selects the YAML engine: `:yeptris` (default — Marshal bulk materialization in yeptris 0.1.28, 4.5–5x Psych load) or `:psych` (`CANON_YAML_BACKEND=psych` forces the stdlib engine). The default follows availability: yeptris when loadable, Psych otherwise. `Canon::YamlParsing` is the single gateway for string loads; `Canon::JsonParsing` mirrors it for JSON (the same yeptris engine serves both — `Yeptris::YAML.load` auto-detects JSON and routes to the native C-API materializer; JSON falls back to stdlib unless `YamlBackend.yeptris_native?`, since the FFI ladder is ~29x slower than the stdlib C extension). YAML dumps also default to yeptris (0.6.5+'s emitter is byte-identical to Psych across the dump corpus — nil/Time/special-float/block-scalar/key-type families, yeptris#290/#300 closed; `header: true` supplies the `---` marker; `YamlParsing.dump` is the seam). **JSON defaults to the strict yeptris surface whenever the native materializer is installed** (yeptris 0.1.13.4 ships platform gems — zero compilation, zero env; parity spec-pinned to `JSON.parse` upstream). The parity gate (`spec/canon/yaml_engine_parity_spec.rb`) includes dump-lane byte-parity pins (yeptris#290/#300 closed in 0.6.5) — the executable gate for future yeptris releases. Never `require "yeptris/psych"` — it rebinds the global `::Psych` constant for the whole process; only the namespaced `Yeptris::YAML` API is used.
|
|
153
153
|
|
|
154
154
|
### Format Detection
|
|
155
155
|
|
|
@@ -70,8 +70,8 @@ module Canon
|
|
|
70
70
|
|
|
71
71
|
if opts[:verbose]
|
|
72
72
|
# Format YAML for display
|
|
73
|
-
yaml_str1 = obj1.is_a?(String) ? obj1 :
|
|
74
|
-
yaml_str2 = obj2.is_a?(String) ? obj2 :
|
|
73
|
+
yaml_str1 = obj1.is_a?(String) ? obj1 : Canon::YamlParsing.dump(obj1)
|
|
74
|
+
yaml_str2 = obj2.is_a?(String) ? obj2 : Canon::YamlParsing.dump(obj2)
|
|
75
75
|
|
|
76
76
|
ComparisonResult.new(
|
|
77
77
|
differences: differences,
|
data/lib/canon/comparison.rb
CHANGED
data/lib/canon/version.rb
CHANGED
data/lib/canon/yaml_parsing.rb
CHANGED
|
@@ -18,6 +18,21 @@ module Canon
|
|
|
18
18
|
# call site) — a canonicalizer treats anchors as content: yeptris
|
|
19
19
|
# resolves them unconditionally, so :true keeps both engines
|
|
20
20
|
# behavior-identical.
|
|
21
|
+
# Serialize a Ruby object graph to YAML. yeptris 0.6.5+'s
|
|
22
|
+
# emitter is byte-identical to Psych across canon's dump corpus
|
|
23
|
+
# (nil/Time/special-float/block-scalar/key-type families —
|
|
24
|
+
# yeptris#290/#300 closed) with header: true supplying the
|
|
25
|
+
# "---" document start Psych emits; Psych serves when yeptris
|
|
26
|
+
# is inactive (CANON_YAML_BACKEND=psych forces it for dumps as
|
|
27
|
+
# for loads).
|
|
28
|
+
def dump(obj)
|
|
29
|
+
if YamlBackend.yeptris?
|
|
30
|
+
::Yeptris::YAML.dump(obj, header: true)
|
|
31
|
+
else
|
|
32
|
+
YAML.dump(obj)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
21
36
|
def safe_load(yaml, permitted_classes: [Symbol, Date, Time],
|
|
22
37
|
aliases: true)
|
|
23
38
|
if YamlBackend.yeptris?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: canon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.52
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: diff-lcs
|
|
@@ -38,20 +38,34 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: leptris
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 1.9.193
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.9.193
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: moxml
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
44
58
|
requirements:
|
|
45
59
|
- - "~>"
|
|
46
60
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.5.
|
|
61
|
+
version: 0.5.60
|
|
48
62
|
type: :runtime
|
|
49
63
|
prerelease: false
|
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
65
|
requirements:
|
|
52
66
|
- - "~>"
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.5.
|
|
68
|
+
version: 0.5.60
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: nokogiri
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -136,6 +150,20 @@ dependencies:
|
|
|
136
150
|
- - ">="
|
|
137
151
|
- !ruby/object:Gem::Version
|
|
138
152
|
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: yeptris
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: 0.6.5
|
|
160
|
+
type: :runtime
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - "~>"
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: 0.6.5
|
|
139
167
|
description: |-
|
|
140
168
|
Canon provides canonicalization and pretty-printing for various serialization
|
|
141
169
|
formats (XML, HTML, JSON, YAML), producing standardized forms suitable for
|