instance method
node_to_text
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3 PrivateSignature
node_to_text(node, default = nil)
Converts a document node into a String. If the node could not be converted into a String for any reason, default will be returned.
- node
-
Document node to be converted.
- default
-
Value to be returned, if node could not be converted.
Parameters
-
nodereq -
defaultopt = nil
Source
# File activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb, line 930
def node_to_text(node, default = nil)
if node.instance_of?(REXML::Element)
node.texts.map { |t| t.value }.join('')
elsif node.instance_of?(REXML::Attribute)
node.value.nil? ? default : node.value.strip
elsif node.instance_of?(REXML::Text)
node.value.strip
else
default
end
end
Defined in activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb line 930
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in XmlSimple