moxml 0.6.8 → 0.6.9
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 +57 -3
- 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: cc0dda0f9bbdf4fb0a15c838dfc7473b449e748b89a06297251b8eca26fc1b00
|
|
4
|
+
data.tar.gz: 7ed72ebaab1c2314a15bde5fcc28c1faa972505d18ad2377aaddaf6d6ba3e7a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60fb29b4a82b964bc1021ab7eeb1f632ab36535ad59f1b546bc6562d46b41fd6e1ef1a92906ff1010bc0f3520fd2aa871a503f7b327e64d8c2852c9611504a48
|
|
7
|
+
data.tar.gz: c388f5f4f58a8e357c736d4cb23afe08b241c007207e70e13f3589baa10341eed4d2da77e6d46e54ccd81da2ded30aa3fd5d935f0d8464b6f6d3b4c334fff3ca
|
|
@@ -1786,7 +1786,9 @@ module Moxml
|
|
|
1786
1786
|
"(empty or whitespace-only input)"]
|
|
1787
1787
|
end
|
|
1788
1788
|
|
|
1789
|
-
register_mint_klasses!(
|
|
1789
|
+
register_mint_klasses!(
|
|
1790
|
+
native_doc, hot: !entity_markers && !entity_mode_keep
|
|
1791
|
+
)
|
|
1790
1792
|
ctx = _context || Context.new(:leptris)
|
|
1791
1793
|
doc = Wrappers::Document.new(native_doc, ctx)
|
|
1792
1794
|
|
|
@@ -2107,10 +2109,62 @@ module Moxml
|
|
|
2107
2109
|
[].freeze
|
|
2108
2110
|
end
|
|
2109
2111
|
|
|
2110
|
-
|
|
2112
|
+
# The hot klass variants (TODO.perf/39(a), leptris-ruby#627):
|
|
2113
|
+
# define_hot_readers installs the C readers (name/content)
|
|
2114
|
+
# directly on the subclass, so lookup answers in C with no
|
|
2115
|
+
# contract-module shadow. The C bodies must not shadow
|
|
2116
|
+
# contract semantics: `attribute` answers the value string
|
|
2117
|
+
# (the contract returns the attribute object) and `name` is
|
|
2118
|
+
# element-shaped (non-element contracts shape it), so those
|
|
2119
|
+
# stay shadowed. Memoized lazily: the Native module can be
|
|
2120
|
+
# defined after this file evaluates.
|
|
2121
|
+
def hot_kind_classes
|
|
2122
|
+
@hot_kind_classes ||=
|
|
2123
|
+
if NATIVE_READ_LAYER &&
|
|
2124
|
+
defined?(::Leptris::XML::Native) &&
|
|
2125
|
+
::Leptris::XML::Native.respond_to?(:define_hot_readers)
|
|
2126
|
+
# Elements: name + content (the C bodies ARE the
|
|
2127
|
+
# contract answers for clean documents). Text: content
|
|
2128
|
+
# only (the text-payload read). Comment/cdata/PI keep
|
|
2129
|
+
# the contract classes outright - their payload reads
|
|
2130
|
+
# are contract-shaped (the reference differential pins
|
|
2131
|
+
# them), so hot classes for those kinds answer wrongly.
|
|
2132
|
+
hot_el = Class.new(Identity::ELEMENT)
|
|
2133
|
+
::Leptris::XML::Native.define_hot_readers(hot_el)
|
|
2134
|
+
hot_el.remove_method(:attribute)
|
|
2135
|
+
hot_tx = Class.new(Identity::TEXT)
|
|
2136
|
+
::Leptris::XML::Native.define_hot_readers(hot_tx)
|
|
2137
|
+
hot_tx.remove_method(:attribute)
|
|
2138
|
+
hot_tx.remove_method(:name)
|
|
2139
|
+
hot_set = [hot_el, hot_tx, Identity::COMMENT,
|
|
2140
|
+
Identity::CDATA,
|
|
2141
|
+
Identity::PROCESSING_INSTRUCTION].freeze
|
|
2142
|
+
# The klass-propagating reads (#246) mint through the
|
|
2143
|
+
# RECEIVER class's child map - the hot classes need their
|
|
2144
|
+
# own, or the C visit mint yields nil for their entries
|
|
2145
|
+
# (the root-level XPath gather truncated at depth >= 2
|
|
2146
|
+
# while the C children read stayed correct).
|
|
2147
|
+
# Install ONLY on the hot classes: the contract kinds'
|
|
2148
|
+
# maps are the load-time installation - overwriting them
|
|
2149
|
+
# here would re-route the contract kinds' children mints.
|
|
2150
|
+
if NATIVE_KLASS_CHILDREN
|
|
2151
|
+
hot_set.first(2).each do |klass|
|
|
2152
|
+
klass.install_child_klasses(hot_set)
|
|
2153
|
+
end
|
|
2154
|
+
end
|
|
2155
|
+
hot_set
|
|
2156
|
+
end
|
|
2157
|
+
end
|
|
2158
|
+
|
|
2159
|
+
def register_mint_klasses!(binding_doc, hot: false)
|
|
2111
2160
|
return binding_doc unless NATIVE_C_MINT && binding_doc
|
|
2112
2161
|
|
|
2113
|
-
|
|
2162
|
+
klass_set = if hot && (klasses = hot_kind_classes)
|
|
2163
|
+
klasses
|
|
2164
|
+
else
|
|
2165
|
+
MINT_KIND_CLASSES
|
|
2166
|
+
end
|
|
2167
|
+
binding_doc.register_wrapper_klasses(klass_set)
|
|
2114
2168
|
binding_doc
|
|
2115
2169
|
end
|
|
2116
2170
|
|
data/lib/moxml/version.rb
CHANGED