Sha256: c512448db3b5035b475fae493a2f6abc328c7d1724bd686653777a277ea322d6
Contents?: true
Size: 1.21 KB
Versions: 26
Compression:
Stored size: 1.21 KB
Contents
module OEmbed module Formatter # Handles parsing XML values using the best available backend. module XML # A Array of all available backends, listed in order of preference. DECODERS = %w(XmlSimple REXML) class << self include ::OEmbed::Formatter::Base # Returns the current XML backend. def backend set_default_backend unless defined?(@backend) raise OEmbed::FormatNotSupported, :xml unless defined?(@backend) @backend end def set_default_backend DECODERS.find do |name| begin self.backend = name true rescue LoadError # Try next decoder. false end end end private def backend_path 'xml/backends' end def test_value <<-XML <?xml version="1.0" encoding="utf-8" standalone="yes"?> <oembed> <version>1.0</version> <string>test</string> <int>42</int> <html><i>Cool's</i>\n the "word"!</html> </oembed> XML end end # self end # XML end end
Version data entries
26 entries across 26 versions & 2 rubygems