module OEmbed::Formatter::XML::Backends::XmlSimple
Use the xml-simple gem to parse XML
values.
Public Instance Methods
decode(xml)
click to toggle source
Parses an XML
string or IO and convert it into an object.
# File lib/oembed/formatter/xml/backends/xmlsimple.rb, line 13 def decode(xml) if !xml.respond_to?(:read) xml = StringIO.new(xml) end ::XmlSimple.xml_in(xml, 'ForceArray'=>false) rescue case $! when parse_error raise $! else raise parse_error, "Couldn't parse the given document." end end
decode_fail_msg()
click to toggle source
# File lib/oembed/formatter/xml/backends/xmlsimple.rb, line 27 def decode_fail_msg "The version of the xml-simple library you have installed isn't parsing XML like ruby-oembed expected." end
parse_error()
click to toggle source
# File lib/oembed/formatter/xml/backends/xmlsimple.rb, line 31 def parse_error ::ArgumentError end