moxml 0.5.89 → 0.5.90

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 447a88de690007bd60f38647c8edf17a9b9814ef91084532561f4f093080675f
4
- data.tar.gz: 2c806adc75e15a77449846350c28ac215525d46381ae88e283b406309405d9ed
3
+ metadata.gz: 7bc4e2c9207f89607513a994d6bac3024c2c26b429d00dd34f96500144642fab
4
+ data.tar.gz: dfd41bdfc177befc2d1dcf66474c8de154b93fd2ad08fb34c047230a82f39f5f
5
5
  SHA512:
6
- metadata.gz: 8620d5a066a98d7d232bc2f09c2b81a552ce600d38f3c45451895a67eef643283f3ed33ef6f9afcd1ecf9cdb12a4b4d12f6c5d2c1826721ee8c7e035b059414e
7
- data.tar.gz: 92c2627b4d2c058028fc4083826a6cf3416808b98ddf7648dbba0e549fa4f50abf2d910fe5a00bc613031bfafff8c37949c352d949ba0898e031419b88f930e3
6
+ metadata.gz: 9d3f6fa7b5ceccae41918847bba8b5c97f03bdd5f0f46915c4e93dd98dbf5206f5e0596286761a43a8bdc2248346871f174ef3233bf2107809878a1d1cac770f
7
+ data.tar.gz: e09362c14974e1a671476801a7cea739fa0dbe5d5058d7357f0399d4afe09c92ec023bef774bceaead5d878b5fe5aa3e4f02c252a128a056f51f8d011696888f
@@ -286,6 +286,18 @@ module Moxml
286
286
  # (the second allocation of the pair) drops out. Kind
287
287
  # order is the C layer's node-type ints: element, text,
288
288
  # comment, cdata, pi.
289
+ # C-side wrapper mint (leptris-ruby#340, bindings >= 1.9.255.2):
290
+ # Document#register_wrapper_klasses makes the binding's walk
291
+ # cache mint the registered consumer classes, and
292
+ # create_element_with_attrs_wrapped mints the wrapper in the
293
+ # same construction crossing. moxml registers the Identity
294
+ # classes — walked and built nodes arrive already carrying the
295
+ # contract, and the Ruby shell mint drops out entirely
296
+ # (moxml#288: the entire remaining walk/build gap).
297
+ NATIVE_C_MINT =
298
+ NATIVE_IDENTITY &&
299
+ Gem::Version.new(::Leptris::VERSION) >= Gem::Version.new("1.9.255.2")
300
+
289
301
  NATIVE_KLASS_CHILDREN =
290
302
  NATIVE_IDENTITY &&
291
303
  Gem::Version.new(::Leptris::VERSION) >= Gem::Version.new("1.9.193.2")
@@ -349,6 +361,15 @@ module Moxml
349
361
  # generic wrap path's node_type probe, wrap_native detour,
350
362
  # type map, and tap all drop out. Identity rides the
351
363
  # @moxml_wrapper ivar (cache-stable nodes, #270).
364
+ IDENTITY_WALK_TYPE = {
365
+ Identity::ELEMENT => :element,
366
+ Identity::TEXT => :text,
367
+ Identity::CDATA => :cdata,
368
+ Identity::COMMENT => :comment,
369
+ Identity::PROCESSING_INSTRUCTION =>
370
+ :processing_instruction,
371
+ }.freeze
372
+
352
373
  BINDING_FAST_WRAP = {
353
374
  ::Leptris::XML::Element => [Moxml::Wrappers::Element, :element],
354
375
  ::Leptris::XML::Text => [Moxml::Wrappers::Text, :text],
@@ -362,6 +383,19 @@ module Moxml
362
383
  cached = node.instance_variable_get(:@moxml_wrapper)
363
384
  return cached if cached
364
385
 
386
+ # C-mint (#340): registered walks mint the Identity
387
+ # classes, which already carry the contract — the node
388
+ # IS the wrapper. Prime in place with a self-marker
389
+ # (never a shell, never the WeakMap round trip).
390
+ if NATIVE_C_MINT && node.is_a?(::Moxml::Node)
391
+ type = IDENTITY_WALK_TYPE[node.class]
392
+ return nil unless type
393
+
394
+ node.prime_contract(node, context, self, type)
395
+ node.instance_variable_set(:@moxml_wrapper, node)
396
+ return node
397
+ end
398
+
365
399
  entry = BINDING_FAST_WRAP[node.class]
366
400
  return nil unless entry
367
401
 
@@ -729,6 +763,7 @@ module Moxml
729
763
  recover_errors = [e.message]
730
764
  create_document
731
765
  end
766
+ register_mint_klasses!(native_doc)
732
767
  ctx = _context || Context.new(:leptris)
733
768
  doc = Wrappers::Document.new(native_doc, ctx)
734
769
 
@@ -909,7 +944,28 @@ module Moxml
909
944
  end
910
945
 
911
946
  def create_document(_native_doc = nil)
912
- ::Leptris::XML::Document.create
947
+ register_mint_klasses!(::Leptris::XML::Document.create)
948
+ end
949
+
950
+ # Register the Identity classes as the document's walk- and
951
+ # construction-mint classes (NATIVE_C_MINT, leptris-ruby#340):
952
+ # kind order matches install_child_klasses — element, text,
953
+ # comment, cdata, pi. Parsed documents register right after
954
+ # the binding mint. Unregistered bindings (older floors, the
955
+ # C-mint off) are unchanged — the shell path stays.
956
+ MINT_KIND_CLASSES = [
957
+ Identity::ELEMENT,
958
+ Identity::TEXT,
959
+ Identity::COMMENT,
960
+ Identity::CDATA,
961
+ Identity::PROCESSING_INSTRUCTION,
962
+ ].freeze
963
+
964
+ def register_mint_klasses!(binding_doc)
965
+ return binding_doc unless NATIVE_C_MINT && binding_doc
966
+
967
+ binding_doc.register_wrapper_klasses(MINT_KIND_CLASSES)
968
+ binding_doc
913
969
  end
914
970
 
915
971
  # Native builder factories: one C call and a TypedData wrap.
@@ -1507,6 +1563,20 @@ module Moxml
1507
1563
  return nil unless ::Leptris::XML::Native.respond_to?(:create_element_with_attrs)
1508
1564
 
1509
1565
  flat = attrs.flatten
1566
+ # C-mint (#340): on registered documents the wrapped face
1567
+ # mints the wrapper IN the construction crossing — the
1568
+ # registered Identity class arrives contract-carrying, no
1569
+ # separate Node.wrap and no canonical convergence pass.
1570
+ if NATIVE_C_MINT &&
1571
+ ::Leptris::XML::Native.respond_to?(:create_element_with_attrs_wrapped)
1572
+ minted = ::Leptris::XML::Native.create_element_with_attrs_wrapped(
1573
+ doc, binding_parent.c_address, name.to_s, flat
1574
+ )
1575
+ return minted unless minted.nil?
1576
+
1577
+ return nil
1578
+ end
1579
+
1510
1580
  addr = ::Leptris::XML::Native.create_element_with_attrs(
1511
1581
  doc.c_address, binding_parent.c_address, name.to_s, flat
1512
1582
  )
data/lib/moxml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Moxml
4
- VERSION = "0.5.89"
4
+ VERSION = "0.5.90"
5
5
  end
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.89
4
+ version: 0.5.90
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-27 00:00:00.000000000 Z
11
+ date: 2026-09-28 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