moxml 0.5.75 → 0.5.76
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/node.rb +31 -5
- data/lib/moxml/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2df70c844d6a4b34a8b6088ab84555def6c66f73b6c975d4252f1337df9db206
|
|
4
|
+
data.tar.gz: 1ca3ee46f0c416f463eeea9d68954b17d9121c6816dc654c9d3e4ba420343e10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c8288a741d4230ebe5f228ea2b7085ef74177b527bf661dd35395a27c41515150949fadfc15f267f0eec9d3ac74c3b779c942b62ad8c5ff4dcc8c85a0398e5b
|
|
7
|
+
data.tar.gz: a547141ac0046f1d1ece0e55eecba71e5c1ec124a91179a45d2e4e4a57d8cfe8a50422b24a91060267bafc04d4ce8cb1efcd507ebcdb5520959540697850bb9d
|
data/lib/moxml/node.rb
CHANGED
|
@@ -38,9 +38,20 @@ module Moxml
|
|
|
38
38
|
|
|
39
39
|
def refresh_native!(new_native)
|
|
40
40
|
unless new_native.equal?(@native)
|
|
41
|
-
|
|
41
|
+
# Cache-stable binding nodes carry the wrapper in an ivar
|
|
42
|
+
# (see Node.wrap_with) — re-point it there; other natives
|
|
43
|
+
# ride the context map.
|
|
44
|
+
if @native.instance_variable_defined?(:@moxml_wrapper)
|
|
45
|
+
@native.instance_variable_set(:@moxml_wrapper, nil)
|
|
46
|
+
else
|
|
47
|
+
context.unregister_wrapper(@native)
|
|
48
|
+
end
|
|
42
49
|
@native = new_native
|
|
43
|
-
|
|
50
|
+
if new_native.instance_variable_defined?(:@c_address)
|
|
51
|
+
new_native.instance_variable_set(:@moxml_wrapper, self)
|
|
52
|
+
else
|
|
53
|
+
context.register_wrapper(new_native, self)
|
|
54
|
+
end
|
|
44
55
|
clear_native_memo!
|
|
45
56
|
end
|
|
46
57
|
self
|
|
@@ -580,7 +591,17 @@ module Moxml
|
|
|
580
591
|
def self.wrap_with(node, context, adapter)
|
|
581
592
|
return nil if node.nil?
|
|
582
593
|
|
|
583
|
-
|
|
594
|
+
# Cache-stable binding nodes carry their wrapper directly
|
|
595
|
+
# (#312): the binding's document-owned cache hands the SAME
|
|
596
|
+
# node object for the engine node's whole lifetime, so an
|
|
597
|
+
# ivar is the identity map — one ivar read beats the WeakMap
|
|
598
|
+
# round trip, and the wrapper dies with the node (document
|
|
599
|
+
# scope) exactly like the binding's own wrappers.
|
|
600
|
+
cached = if node.instance_variable_defined?(:@moxml_wrapper)
|
|
601
|
+
node.instance_variable_get(:@moxml_wrapper)
|
|
602
|
+
else
|
|
603
|
+
context.wrapper_for(node)
|
|
604
|
+
end
|
|
584
605
|
return cached if cached
|
|
585
606
|
|
|
586
607
|
type = adapter.node_type(node)
|
|
@@ -601,8 +622,13 @@ module Moxml
|
|
|
601
622
|
end
|
|
602
623
|
|
|
603
624
|
klass = node_type_map[type] || Wrappers::Node
|
|
604
|
-
klass.new(node, context, adapter, type)
|
|
605
|
-
|
|
625
|
+
wrapper = klass.new(node, context, adapter, type)
|
|
626
|
+
if node.instance_variable_defined?(:@c_address)
|
|
627
|
+
node.instance_variable_set(:@moxml_wrapper, wrapper)
|
|
628
|
+
else
|
|
629
|
+
context.register_wrapper(node, wrapper)
|
|
630
|
+
end
|
|
631
|
+
wrapper
|
|
606
632
|
end
|
|
607
633
|
|
|
608
634
|
def self.adapter(context)
|
data/lib/moxml/version.rb
CHANGED