Module: OEmbed::Formatter::XML
- Extended by:
- Base
- Defined in:
- lib/oembed/formatter/xml.rb,
lib/oembed/formatter/xml/backends/rexml.rb,
lib/oembed/formatter/xml/backends/nokogiri.rb,
lib/oembed/formatter/xml/backends/xmlsimple.rb
Overview
Handles parsing XML values using the best available backend.
Defined Under Namespace
Modules: Backends
Constant Summary collapse
- DECODERS =
A Array of all available backends, listed in order of preference.
%w(XmlSimple REXML)
Class Method Summary collapse
-
.backend ⇒ Object
Returns the current XML backend.
- .set_default_backend ⇒ Object
Methods included from Base
backend=, decode, reset_backend, supported?, with_backend
Class Method Details
.backend ⇒ Object
Returns the current XML backend.
12 13 14 15 16 |
# File 'lib/oembed/formatter/xml.rb', line 12 def backend set_default_backend unless defined?(@backend) raise OEmbed::FormatNotSupported, :xml unless defined?(@backend) @backend end |
.set_default_backend ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/oembed/formatter/xml.rb', line 18 def set_default_backend DECODERS.find do |name| begin self.backend = name true rescue LoadError # Try next decoder. false end end end |