moxml 0.5.177 → 0.5.178
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/moxml/adapter/leptris.rb +43 -5
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/adapter_capabilities_spec.rb +25 -0
- 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: ab4976a5d2b2a909d73204d71c0c6d67285ab3e1fd9c53db7bffc00e39425cca
|
|
4
|
+
data.tar.gz: a7d948364c456db7f8201b62a807758121d28d9635326eb91d68c43f499ff81f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b1ff2e8c6dcb6d25e6b07270f3234a8ce7daf7475544b63f070405645c423f241e0212b4260ad688c1cb7433d8bc2ea7d1e3f4a0a14e9dcf4a67e832d53ee01
|
|
7
|
+
data.tar.gz: bf6c389706fb4d28e07af24a4d81bdacf0e4823d9bac95ea2f0ce7f55b08277cdcf8aa800424125a937fb3bf2be603b336b165f01aa9a9048277178357c4471d
|
|
@@ -341,6 +341,17 @@ module Moxml
|
|
|
341
341
|
# (Leptris::VERSION), +engine_version+ is libleptris's own
|
|
342
342
|
# (the leptris_version() C face, face-probed — nil on a
|
|
343
343
|
# binding without it).
|
|
344
|
+
#
|
|
345
|
+
# Support faces are DESCRIPTOR-AUTHORITATIVE (leptris-ruby#572
|
|
346
|
+
# bridge, engine leptris#1905): a face answers true only when
|
|
347
|
+
# the ENGINE's capability bitset serves it AND the binding
|
|
348
|
+
# exposes it — a face the engine serves but the binding has
|
|
349
|
+
# not bridged is indistinguishable from absent without the
|
|
350
|
+
# bitset. On a binding without the bridge the probe answer
|
|
351
|
+
# stands alone (never narrowed by missing data). The bit
|
|
352
|
+
# values decode the engine's LEPTRIS_CAP_* layout (bits
|
|
353
|
+
# append per the engine's contract; the binding re-encodes
|
|
354
|
+
# nothing, the model names them).
|
|
344
355
|
def capabilities
|
|
345
356
|
@capabilities ||= {
|
|
346
357
|
binding_version: ::Leptris::VERSION,
|
|
@@ -353,17 +364,44 @@ module Moxml
|
|
|
353
364
|
add_element_full: ADD_ELEMENT_FULL,
|
|
354
365
|
native_strings_utf8: !NATIVE_STRINGS_UTF8.nil?,
|
|
355
366
|
native_mutations_coherent: !NATIVE_MUTATIONS_COHERENT.nil?,
|
|
356
|
-
native_entity_refs:
|
|
367
|
+
native_entity_refs:
|
|
368
|
+
!NATIVE_ENTITY_REFS.nil? && engine_serves?(:entity_ref_nodes),
|
|
357
369
|
native_bulk_fixed: !NATIVE_BULK_FIXED.nil?,
|
|
358
370
|
native_plan_structs: NATIVE_PLAN_STRUCTS,
|
|
359
371
|
native_plan_typed: NATIVE_PLAN_TYPED,
|
|
360
|
-
digest: DIGEST_SUPPORTED,
|
|
361
|
-
xsd: XSD_SUPPORTED,
|
|
362
|
-
relaxng: RELAXNG_SUPPORTED,
|
|
363
|
-
xslt: XSLT_SUPPORTED,
|
|
372
|
+
digest: DIGEST_SUPPORTED && engine_serves?(:digest),
|
|
373
|
+
xsd: XSD_SUPPORTED && engine_serves?(:xsd),
|
|
374
|
+
relaxng: RELAXNG_SUPPORTED && engine_serves?(:relaxng),
|
|
375
|
+
xslt: XSLT_SUPPORTED && engine_serves?(:xslt),
|
|
364
376
|
}.freeze
|
|
365
377
|
end
|
|
366
378
|
|
|
379
|
+
# The engine's capability descriptor (raw bitset), or nil on
|
|
380
|
+
# a binding without the bridge. The bit values are the
|
|
381
|
+
# engine's LEPTRIS_CAP_* layout at descriptor version 1 —
|
|
382
|
+
# bits append, so the decode stays valid on later sets.
|
|
383
|
+
ENGINE_CAPS_BITS = {
|
|
384
|
+
digest: 1 << 9,
|
|
385
|
+
xsd: 1 << 10,
|
|
386
|
+
relaxng: 1 << 12,
|
|
387
|
+
xslt: 1 << 14,
|
|
388
|
+
entity_ref_nodes: 1 << 24,
|
|
389
|
+
}.freeze
|
|
390
|
+
|
|
391
|
+
def engine_serves?(face)
|
|
392
|
+
descriptor = engine_descriptor
|
|
393
|
+
return true unless descriptor
|
|
394
|
+
|
|
395
|
+
descriptor[:caps].anybits?(ENGINE_CAPS_BITS.fetch(face))
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
def engine_descriptor
|
|
399
|
+
@engine_descriptor ||=
|
|
400
|
+
if defined?(::Leptris::XML.capabilities)
|
|
401
|
+
::Leptris::XML.capabilities
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
|
|
367
405
|
# WeakMap has no #clear — 0.5.100's valve crashed every parse
|
|
368
406
|
# crossing the cap on 3.4+ (NoMethodError). Replace the
|
|
369
407
|
# registry wholesale, type-preserving: the WeakMap flavor
|
data/lib/moxml/version.rb
CHANGED
|
@@ -52,6 +52,31 @@ RSpec.describe "engine capability report" do
|
|
|
52
52
|
expect(caps[:xslt]).to be(true)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
# leptris-ruby#572: the binding bridges the engine's capability
|
|
56
|
+
# descriptor, and the support faces answer its verdict ANDed with
|
|
57
|
+
# the binding probe — a face the engine serves but the binding has
|
|
58
|
+
# not bridged is not "true" (the half-face trap the version-gate
|
|
59
|
+
# class could not see).
|
|
60
|
+
it "answers the support faces from the engine descriptor bitset" do
|
|
61
|
+
skip "requires the binding's descriptor bridge (leptris 1.9.396+)" unless
|
|
62
|
+
defined?(Leptris::XML.capabilities)
|
|
63
|
+
|
|
64
|
+
caps = Moxml::Adapter::Leptris.capabilities
|
|
65
|
+
descriptor = Leptris::XML.capabilities
|
|
66
|
+
expect(descriptor[:descriptor_version]).to be(1)
|
|
67
|
+
{
|
|
68
|
+
digest: 1 << 9,
|
|
69
|
+
xsd: 1 << 10,
|
|
70
|
+
relaxng: 1 << 12,
|
|
71
|
+
xslt: 1 << 14,
|
|
72
|
+
}.each do |face, bit|
|
|
73
|
+
served = descriptor[:caps].anybits?(bit)
|
|
74
|
+
expect(caps[face]).to eql(served),
|
|
75
|
+
"#{face} must answer the engine bitset's verdict " \
|
|
76
|
+
"(ANDed with the binding probe)"
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
55
80
|
it "is memoized — repeated queries answer the same frozen object" do
|
|
56
81
|
expect(Moxml::Adapter::Leptris.capabilities)
|
|
57
82
|
.to equal(Moxml::Adapter::Leptris.capabilities)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.178
|
|
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-10-
|
|
11
|
+
date: 2026-10-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Moxml is a unified XML manipulation library that provides a common API
|