instance method
collapse_text_node
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3 PrivateSignature
collapse_text_node(hash, element)
Collapses a text node and merges it with an existing Hash, if possible. Thanks to Curtis Schofield for reporting a subtle bug.
- hash
-
Hash to merge text node value with, if possible.
- element
-
Text node to be collapsed.
Parameters
-
hashreq -
elementreq
Source
# File activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb, line 523
def collapse_text_node(hash, element)
value = node_to_text(element)
if empty(value) && !element.has_attributes?
return {}
end
if element.has_attributes? && !@options['noattr']
return merge(hash, @options['contentkey'], value)
else
if @options['forcecontent']
return merge(hash, @options['contentkey'], value)
else
return value
end
end
end
Defined in activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb line 523
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in XmlSimple