crack
crack copied to clipboard
Ability to disable monkey-patched @attributes instance variable on Strings
REXMLUtilityNode seems to set an 'attributes' instance variable on String instances.
While not a show-stopper, this makes YAML serialization quite verbose, eg:
:postal_code: !str
str: postal code
"@attributes": {}
Would be good to avoid doing this if there aren't any attributes, or indeed to have an option to turn off this monkey-patching altogether.
The code here seems to be the culprit:
if @text
t = typecast_value( unnormalize_xml_entities( inner_html ) )
t.class.send(:attr_accessor, :attributes)
t.attributes = attributes
return { name => t }
else