moxml 0.5.60 → 0.5.61
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 +72 -37
- 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: 432ffb6c040c2b5689552a050b01835b792cde27ddc816981fd186fd83b9df7d
|
|
4
|
+
data.tar.gz: 917f7712e1799209f6d1c3f832fb5a3de492da5e570959a9d8bf2a8b4902d537
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6f0a69c52df888bf9afbc2706e755d9844d8d65247720d887cc6fb34c8d855964f278d798b947bfb028ce58f32253ff6ed92101fcc2cf45fe28695170c23405
|
|
7
|
+
data.tar.gz: 90b841bd8eb58119a38dce5333a53f9b37abc70755e69a887c52ab4565d1101727a2dcc40903a4671b92a10d4ba1bd67ab712ac97d37bdd04861359dd4b09bba
|
|
@@ -213,49 +213,84 @@ module Moxml
|
|
|
213
213
|
processing_instruction: PROCESSING_INSTRUCTION,
|
|
214
214
|
}.freeze
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
216
|
+
# Hot-read face selection: bindings >= 1.9.194.1 carry
|
|
217
|
+
# unshadowed aliases (attr_read/text_read) that plain
|
|
218
|
+
# dispatch reaches at method-cache cost — beats
|
|
219
|
+
# UnboundMethod#bind_call (~86ns) on every bare read.
|
|
220
|
+
ELEMENT_CONTRACT_READ =
|
|
221
|
+
::Moxml::ElementBehavior.instance_method(:[])
|
|
222
|
+
|
|
223
|
+
NATIVE_HOT_ALIASES =
|
|
224
|
+
Gem::Version.new(::Leptris::VERSION) >= Gem::Version.new("1.9.194.1")
|
|
225
|
+
|
|
226
|
+
# Doc-level entity-marker memo shared by both hot-read
|
|
227
|
+
# faces (one WeakMap, generation-stamped Integer values).
|
|
228
|
+
ENTITY_DOC_MEMO = ::ObjectSpace::WeakMap.new
|
|
229
|
+
|
|
230
|
+
if NATIVE_HOT_ALIASES
|
|
231
|
+
module Reads
|
|
232
|
+
# Marker presence is a DOCUMENT fact, but the wrapper
|
|
233
|
+
# memo re-derives it per node (the per-read machinery
|
|
234
|
+
# was ~a quarter of the consumer walk). Doc-level
|
|
235
|
+
# WeakMap, generation-stamped into one Integer
|
|
236
|
+
# (immediates make safe weak values): one C document
|
|
237
|
+
# read plus one map hit per bare read. Entries die
|
|
238
|
+
# with their documents; a stale generation re-derives.
|
|
239
|
+
def doc_entity_bearing?
|
|
240
|
+
doc = NN_DOCUMENT.bind_call(self)
|
|
241
|
+
memo = ENTITY_DOC_MEMO[doc]
|
|
242
|
+
gen = ::Moxml::Adapter::Leptris.serialize_generation
|
|
243
|
+
return memo.allbits?(1) if memo && (memo >> 1) == gen
|
|
244
|
+
|
|
245
|
+
bearing = ::Moxml::Adapter::Leptris.entity_bearing?(self)
|
|
246
|
+
ENTITY_DOC_MEMO[doc] = (gen << 1) | (bearing ? 1 : 0)
|
|
247
|
+
bearing
|
|
248
|
+
end
|
|
244
249
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
def [](key)
|
|
251
|
+
if key.is_a?(String) && !key.include?(":")
|
|
252
|
+
value = attr_read(key)
|
|
253
|
+
return value unless value.is_a?(String) && doc_entity_bearing?
|
|
254
|
+
|
|
255
|
+
return ::Moxml::Adapter::Leptris.restore_entities(value)
|
|
256
|
+
end
|
|
249
257
|
|
|
250
|
-
|
|
258
|
+
ELEMENT_CONTRACT_READ.bind_call(self, key)
|
|
251
259
|
end
|
|
252
260
|
|
|
253
|
-
|
|
261
|
+
def text
|
|
262
|
+
value = text_read
|
|
263
|
+
value.is_a?(String) && doc_entity_bearing? ? ::Moxml::Adapter::Leptris.restore_entities(value) : value
|
|
264
|
+
end
|
|
254
265
|
end
|
|
266
|
+
else
|
|
267
|
+
module Reads
|
|
268
|
+
def doc_entity_bearing?
|
|
269
|
+
doc = NN_DOCUMENT.bind_call(self)
|
|
270
|
+
memo = ENTITY_DOC_MEMO[doc]
|
|
271
|
+
gen = ::Moxml::Adapter::Leptris.serialize_generation
|
|
272
|
+
return memo.allbits?(1) if memo && (memo >> 1) == gen
|
|
273
|
+
|
|
274
|
+
bearing = ::Moxml::Adapter::Leptris.entity_bearing?(self)
|
|
275
|
+
ENTITY_DOC_MEMO[doc] = (gen << 1) | (bearing ? 1 : 0)
|
|
276
|
+
bearing
|
|
277
|
+
end
|
|
255
278
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
279
|
+
def [](key)
|
|
280
|
+
if key.is_a?(String) && !key.include?(":")
|
|
281
|
+
value = NN_ATTRIBUTE.bind_call(self, key)
|
|
282
|
+
return value unless value.is_a?(String) && doc_entity_bearing?
|
|
283
|
+
|
|
284
|
+
return ::Moxml::Adapter::Leptris.restore_entities(value)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
ELEMENT_CONTRACT_READ.bind_call(self, key)
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def text
|
|
291
|
+
value = NN_CONTENT.bind_call(self)
|
|
292
|
+
value.is_a?(String) && doc_entity_bearing? ? ::Moxml::Adapter::Leptris.restore_entities(value) : value
|
|
293
|
+
end
|
|
259
294
|
end
|
|
260
295
|
end
|
|
261
296
|
ELEMENT.include(Reads)
|
data/lib/moxml/version.rb
CHANGED