Sha256: d2dd00eb595370ebe6d7302a815994a765d93f92e409da83443aff773621fd6c

Contents?: true

Size: 557 Bytes

Versions: 8

Compression:

Stored size: 557 Bytes

Contents

module EPUB
  class Parser
    class XMLDocument
      class << self
        attr_accessor :backend

        def new(xml)
          case backend
          when :Oga
            Oga.parse_xml(xml)
          when :Nokogiri
            Nokogiri.XML(xml)
          else
            REXML::Document.new(xml)
          end
        end
      end
    end
  end
end

%i[Nokogiri Oga REXML].each do |backend|
  begin
    require "epub/parser/xml_document/refinements/#{backend.downcase}"
    EPUB::Parser::XMLDocument.backend ||= backend
  rescue LoadError
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
epub-parser-0.4.8 lib/epub/parser/xml_document.rb
epub-parser-0.4.7 lib/epub/parser/xml_document.rb
epub-parser-0.4.6 lib/epub/parser/xml_document.rb
epub-parser-0.4.5 lib/epub/parser/xml_document.rb
epub-parser-0.4.4 lib/epub/parser/xml_document.rb
epub-parser-0.4.3 lib/epub/parser/xml_document.rb
epub-parser-0.4.2 lib/epub/parser/xml_document.rb
epub-parser-0.4.1 lib/epub/parser/xml_document.rb