Sha256: d224f3b024a8469e6146602cfff7d7dbe19e059f4aa00fef16b12d1bac06896c
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# Only allow this backend the xml-simple gem is already loaded raise ::LoadError, "The xml-simple library isn't available. require 'xmlsimple'" unless defined?(XmlSimple) module OEmbed module Formatter module XML module Backends # Use the xml-simple gem to parse XML values. module XmlSimple extend self # Parses an XML string or IO and convert it into an object. 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 def decode_fail_msg "The version of the xml-simple library you have installed isn't parsing XML like ruby-oembed expected." end def parse_error ::ArgumentError end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-oembed-0.8.3 | lib/oembed/formatter/xml/backends/xmlsimple.rb |