Module: Moxml::Adapter::CustomizedOga::RawValueOverride
- Defined in:
- lib/moxml/adapter/customized_oga/raw_value_override.rb
Overview
Bypass Oga's lazy decoder for user-authored values.
Oga::XML::Attribute#value and Oga::XML::Text#text decode @value /
@text on first read via Oga::EntityDecoder. EntityDecoderOverride
makes that decode single-pass for parsed input. But user-authored
values are already data — running them through the decoder again
would re-interpret any literal & / &#NN; substrings as entity
references. So we route the read through the NativeAttachment
sidecar first; if the adapter stored the verbatim value there, we
return it as-is, otherwise we fall through to Oga's normal read.
Instance Method Summary collapse
Instance Method Details
#text ⇒ Object
31 32 33 34 35 36 |
# File 'lib/moxml/adapter/customized_oga/raw_value_override.rb', line 31 def text cached = ::Moxml::Adapter::Oga..get(self, :raw_text) return cached unless cached.nil? super end |
#text=(new_value) ⇒ Object
38 39 40 41 |
# File 'lib/moxml/adapter/customized_oga/raw_value_override.rb', line 38 def text=(new_value) ::Moxml::Adapter::Oga..set(self, :raw_text, new_value) super end |