moxml 0.5.48 → 0.5.49
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/base.rb +8 -0
- data/lib/moxml/adapter/leptris.rb +20 -0
- data/lib/moxml/node.rb +13 -0
- data/lib/moxml/version.rb +1 -1
- 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: 1e7f648665fbf11423b43ed957f111cabe57a732b2037d6e7d6d718beae4e0c3
|
|
4
|
+
data.tar.gz: ec4ac686e3c83b794944c02a3f6b92aa964c9e984fb5752b49dbeb08812e0f61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad7b15e82e237a726680c1eed20c0942abbcc74aca205a58681c745548e5a5c9c5048034079b88b1c8f91eddeb742d0eebbd5cc45daca057f852d25da48eb331
|
|
7
|
+
data.tar.gz: 834577776b64caa59e9b363a8a936db9684a20ed7793a6698adbfe0d6633a0770e17f5d24b063352c3931bea1289ac53ceb0bd8c9f7b71ad3fe2f2007ef59a5f
|
data/lib/moxml/adapter/base.rb
CHANGED
|
@@ -141,6 +141,14 @@ module Moxml
|
|
|
141
141
|
nil
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
+
# Subtree walk capability: an adapter with a C-side pre-order
|
|
145
|
+
# traversal (leptris >= 1.9.174.6 visit) walks descendants in
|
|
146
|
+
# one dispatch; nil keeps the recursive children walk. Self
|
|
147
|
+
# is not yielded (each_node semantics).
|
|
148
|
+
def walk_descendants(_native, _context)
|
|
149
|
+
nil
|
|
150
|
+
end
|
|
151
|
+
|
|
144
152
|
def same_node?(one, other)
|
|
145
153
|
one == other
|
|
146
154
|
end
|
|
@@ -176,6 +176,26 @@ module Moxml
|
|
|
176
176
|
nil
|
|
177
177
|
end
|
|
178
178
|
|
|
179
|
+
NATIVE_C_WALK =
|
|
180
|
+
defined?(::Leptris::XML::NativeNode) &&
|
|
181
|
+
Gem::Version.new(::Leptris::VERSION) >= Gem::Version.new("1.9.174.6")
|
|
182
|
+
|
|
183
|
+
# One C visit walk (TODO.perf/27: post-order/abort state in
|
|
184
|
+
# the C callback, rb_yield direct — no FFI closure per
|
|
185
|
+
# node) instead of per-level children walks. Pre-order via
|
|
186
|
+
# entering; depth 0 is the receiver and stays unyielded.
|
|
187
|
+
def walk_descendants(native, context)
|
|
188
|
+
return nil unless NATIVE_C_WALK
|
|
189
|
+
|
|
190
|
+
root = to_binding(native)
|
|
191
|
+
return nil unless root.is_a?(::Leptris::XML::Element) ||
|
|
192
|
+
root.is_a?(::Leptris::XML::Document)
|
|
193
|
+
|
|
194
|
+
root.visit do |node, entering, depth|
|
|
195
|
+
yield Moxml::Node.wrap(node, context) if entering && depth.positive?
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
179
199
|
def record_native_doc(root_native, doc)
|
|
180
200
|
@native_doc_roots[root_native] = doc
|
|
181
201
|
end
|
data/lib/moxml/node.rb
CHANGED
|
@@ -278,6 +278,19 @@ module Moxml
|
|
|
278
278
|
# Recursively yield all descendant nodes
|
|
279
279
|
# Used by XPath descendant-or-self and descendant axes
|
|
280
280
|
def each_node(&block)
|
|
281
|
+
unless block
|
|
282
|
+
# Eager materialization: the leptris C-side walk rb_yields
|
|
283
|
+
# from the C callback and segfaults across fiber-suspended
|
|
284
|
+
# enumerator frames, so the no-block form never enters it.
|
|
285
|
+
nodes = []
|
|
286
|
+
each_node { |node| nodes << node }
|
|
287
|
+
return nodes.each
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Adapters with a C-side subtree walk take it in one
|
|
291
|
+
# dispatch; the recursive children walk stays the fallback.
|
|
292
|
+
return if adapter.walk_descendants(@native, context, &block)
|
|
293
|
+
|
|
281
294
|
children.each do |child|
|
|
282
295
|
yield child
|
|
283
296
|
child.each_node(&block)
|
data/lib/moxml/version.rb
CHANGED
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.49
|
|
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-16 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
|