moxml 0.6.8 → 0.6.10

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: 8536f48b75689cbcc22414adaeac301263c491a66418cf5bc8ea71435b53d9ed
4
- data.tar.gz: f24cc023a8712e3128923860cc647af54fb57e8d70f3c8e426a1b2c291553422
3
+ metadata.gz: 7d6229888c0abf6f82607e066cf95ff310ba7903d4bfe9c2ca01662d22ae46e7
4
+ data.tar.gz: 53e145e8b0e5d53394ea49c010bb03cbb1e1a67a62833e4d5d9ca30ca98e4d08
5
5
  SHA512:
6
- metadata.gz: b0226b4d3d7f9ddea1cc8bd69034b8c243950240c0859d30507920dc1d0f35e27c7fc5ffe5ca11197f8f07e713362c91058376ca7c4991e06e5ee4ddcf3890ae
7
- data.tar.gz: 5da68f6cdae48d0b8c9289780473a6c83d13e140266b9891f92654ec38b53538515b05e6d7198513deabb14ca420a9ca7992ff5ffb734d3b73124921ad93bb34
6
+ metadata.gz: c78bc43513a63cdcf9950a92c395b73388217d764e9d392dea3a5d2eae496b7610aa61ac735c6241422a112ef06789dab99daaa821e0e127333f87fcf1917f60
7
+ data.tar.gz: c30e7d9a45af977fa95239fd382d20499d0fe0f19c8034d87cd6f6084b34c656cc96bf6a42059935332891134a65bd65fc3e5a1169666f402c9e584226848b9d
@@ -107,6 +107,21 @@ module Moxml
107
107
  end
108
108
  end
109
109
 
110
+ # The consumer-contract lane's attribute object
111
+ # (leptris-ruby#635): the shape the bound C factory constructs -
112
+ # (name, value, owner). Covers the walk+read contract
113
+ # (.name/.value); full attribute-node faces stay on the contract
114
+ # classes.
115
+ class LaneAttribute
116
+ attr_reader :name, :value, :owner
117
+
118
+ def initialize(name, value, owner = nil)
119
+ @name = name
120
+ @value = value
121
+ @owner = owner
122
+ end
123
+ end
124
+
110
125
  if Gem::Version.new(::Leptris::VERSION.to_s) <
111
126
  Gem::Version.new(MINIMUM_BINDING_VERSION)
112
127
  raise Moxml::AdapterError.new(
@@ -1786,7 +1801,9 @@ module Moxml
1786
1801
  "(empty or whitespace-only input)"]
1787
1802
  end
1788
1803
 
1789
- register_mint_klasses!(native_doc)
1804
+ register_mint_klasses!(
1805
+ native_doc, hot: !entity_markers && !entity_mode_keep
1806
+ )
1790
1807
  ctx = _context || Context.new(:leptris)
1791
1808
  doc = Wrappers::Document.new(native_doc, ctx)
1792
1809
 
@@ -2107,10 +2124,74 @@ module Moxml
2107
2124
  [].freeze
2108
2125
  end
2109
2126
 
2110
- def register_mint_klasses!(binding_doc)
2127
+ # The hot klass variants (TODO.perf/39(a), leptris-ruby#627):
2128
+ # define_hot_readers installs the C readers (name/content)
2129
+ # directly on the subclass, so lookup answers in C with no
2130
+ # contract-module shadow. The C bodies must not shadow
2131
+ # contract semantics: `attribute` answers the value string
2132
+ # (the contract returns the attribute object) and `name` is
2133
+ # element-shaped (non-element contracts shape it), so those
2134
+ # stay shadowed. Memoized lazily: the Native module can be
2135
+ # defined after this file evaluates.
2136
+ def hot_kind_classes
2137
+ @hot_kind_classes ||=
2138
+ if NATIVE_READ_LAYER &&
2139
+ defined?(::Leptris::XML::Native) &&
2140
+ ::Leptris::XML::Native.respond_to?(:define_hot_readers)
2141
+ # Elements: name + content (the C bodies ARE the
2142
+ # contract answers for clean documents). Text: content
2143
+ # only (the text-payload read). Comment/cdata/PI keep
2144
+ # the contract classes outright - their payload reads
2145
+ # are contract-shaped (the reference differential pins
2146
+ # them), so hot classes for those kinds answer wrongly.
2147
+ hot_el = Class.new(Identity::ELEMENT)
2148
+ ::Leptris::XML::Native.define_hot_readers(hot_el)
2149
+ hot_el.remove_method(:attribute)
2150
+ hot_tx = Class.new(Identity::TEXT)
2151
+ ::Leptris::XML::Native.define_hot_readers(hot_tx)
2152
+ hot_tx.remove_method(:attribute)
2153
+ hot_tx.remove_method(:name)
2154
+ # The consumer-contract binding (leptris-ruby#635): the
2155
+ # descent's shapes constructed in C - children serving
2156
+ # the #530 memo'd list wrapped by the NodeSet factory,
2157
+ # attribute serving the decode getter wrapped by the
2158
+ # attribute factory. Bound on the hot element class
2159
+ # only (the contract kinds keep the Ruby-mediated set).
2160
+ if ::Leptris::XML::Native.respond_to?(:bind_consumer_contract)
2161
+ ::Leptris::XML::Native.bind_consumer_contract(
2162
+ hot_el, Moxml::NodeSet,
2163
+ Moxml::Adapter::Leptris::LaneAttribute
2164
+ )
2165
+ end
2166
+ hot_set = [hot_el, hot_tx, Identity::COMMENT,
2167
+ Identity::CDATA,
2168
+ Identity::PROCESSING_INSTRUCTION].freeze
2169
+ # The klass-propagating reads (#246) mint through the
2170
+ # RECEIVER class's child map - the hot classes need their
2171
+ # own, or the C visit mint yields nil for their entries
2172
+ # (the root-level XPath gather truncated at depth >= 2
2173
+ # while the C children read stayed correct).
2174
+ # Install ONLY on the hot classes: the contract kinds'
2175
+ # maps are the load-time installation - overwriting them
2176
+ # here would re-route the contract kinds' children mints.
2177
+ if NATIVE_KLASS_CHILDREN
2178
+ hot_set.first(2).each do |klass|
2179
+ klass.install_child_klasses(hot_set)
2180
+ end
2181
+ end
2182
+ hot_set
2183
+ end
2184
+ end
2185
+
2186
+ def register_mint_klasses!(binding_doc, hot: false)
2111
2187
  return binding_doc unless NATIVE_C_MINT && binding_doc
2112
2188
 
2113
- binding_doc.register_wrapper_klasses(MINT_KIND_CLASSES)
2189
+ klass_set = if hot && (klasses = hot_kind_classes)
2190
+ klasses
2191
+ else
2192
+ MINT_KIND_CLASSES
2193
+ end
2194
+ binding_doc.register_wrapper_klasses(klass_set)
2114
2195
  binding_doc
2115
2196
  end
2116
2197
 
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.6.8"
4
+ VERSION = "0.6.10"
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.6.8
4
+ version: 0.6.10
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-11-13 00:00:00.000000000 Z
11
+ date: 2026-11-14 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