Module: Moxml::Adapter::Leptris::Identity::Reads
- Defined in:
- lib/moxml/adapter/leptris.rb
Overview
Bindings >= 1.9.194.1 (the floor) carry unshadowed
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#doc_entity_bearing? ⇒ Boolean
Marker presence is a DOCUMENT fact, memoized per wrapper: one Integer stamp ivar (generation << 1 | bearing) — an ivar read + compare per bare read, versus the old doc-WeakMap hit which cost a bind_call plus a map lookup, more than the attribute read itself.
- #text ⇒ Object
Instance Method Details
#[](key) ⇒ Object
257 258 259 260 261 262 263 264 265 266 |
# File 'lib/moxml/adapter/leptris.rb', line 257 def [](key) if key.is_a?(String) && !key.include?(":") value = attr_read(key) return value unless value.is_a?(String) && doc_entity_bearing? return ::Moxml::Adapter::Leptris.restore_entities(value) end ELEMENT_CONTRACT_READ.bind_call(self, key) end |
#doc_entity_bearing? ⇒ Boolean
Marker presence is a DOCUMENT fact, memoized per wrapper: one Integer stamp ivar (generation << 1 | bearing) — an ivar read + compare per bare read, versus the old doc-WeakMap hit which cost a bind_call plus a map lookup, more than the attribute read itself. A stale generation re-derives; stamps die with their wrappers (wrapper lifetime = doc scope).
247 248 249 250 251 252 253 254 255 |
# File 'lib/moxml/adapter/leptris.rb', line 247 def doc_entity_bearing? stamp = @doc_entity_stamp gen = ::Moxml::Adapter::Leptris.serialize_generation return stamp.allbits?(1) if stamp && (stamp >> 1) == gen bearing = ::Moxml::Adapter::Leptris.entity_bearing?(self) @doc_entity_stamp = (gen << 1) | (bearing ? 1 : 0) bearing end |
#text ⇒ Object
268 269 270 271 |
# File 'lib/moxml/adapter/leptris.rb', line 268 def text value = text_read value.is_a?(String) && doc_entity_bearing? ? ::Moxml::Adapter::Leptris.restore_entities(value) : value end |