module OEmbed::Formatter::XML

Handles parsing XML values using the best available backend.

Constants

DECODERS

A Array of all available backends, listed in order of preference.

Public Class Methods

backend() click to toggle source

Returns the current XML backend.

# 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() click to toggle source
# 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

Private Class Methods

backend_path() click to toggle source
# File lib/oembed/formatter/xml.rb, line 32
def backend_path
  'xml/backends'
end
test_value() click to toggle source
# File lib/oembed/formatter/xml.rb, line 36
        def test_value
          <<-XML

<oembed>
  <version>1.0</version>
  <string>test</string>
  <int>42</int>
  <html>&lt;i&gt;Cool's&lt;/i&gt;\n the &quot;word&quot;&#x21;</html>
</oembed>
          XML
        end