Class: EPUB::Parser::XMLDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/epub/parser/xml_document.rb,
lib/epub/parser/xml_document/refinements/oga.rb,
lib/epub/parser/xml_document/refinements/rexml.rb,
lib/epub/parser/xml_document/refinements/nokogiri.rb

Defined Under Namespace

Modules: Refinements

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.backendObject

Returns the value of attribute backend.



5
6
7
# File 'lib/epub/parser/xml_document.rb', line 5

def backend
  @backend
end

Class Method Details

.new(xml) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/epub/parser/xml_document.rb', line 7

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