Module: Moxml

Defined in:
lib/moxml/config.rb,
lib/moxml.rb,
lib/moxml/node.rb,
lib/moxml/text.rb,
lib/moxml/cdata.rb,
lib/moxml/errors.rb,
lib/moxml/adapter.rb,
lib/moxml/comment.rb,
lib/moxml/element.rb,
lib/moxml/version.rb,
lib/moxml/document.rb,
lib/moxml/node_set.rb,
lib/moxml/attribute.rb,
lib/moxml/namespace.rb,
lib/moxml/declaration.rb,
lib/moxml/error_handler.rb,
lib/moxml/processing_instruction.rb

Overview

lib/moxml/error_handler.rb

Defined Under Namespace

Classes: Adapter, Attribute, BackendConfigurationError, BackendError, BackendNotFoundError, CDATAError, Cdata, Comment, Config, DTDValidationError, Declaration, Document, DocumentTooLargeError, DuplicateAttributeError, Element, EncodingError, EntityExpansionError, Error, ErrorHandler, FileNotFoundError, IOError, InvalidCDATAContentError, InvalidNodeTypeError, InvalidOperationError, InvalidOptionsError, InvalidSelectorError, InvalidXPathError, MalformedXMLError, MaxAttributesExceededError, MaxDepthExceededError, MaxNameLengthExceededError, MemoryError, Namespace, NamespaceDeclarationError, NamespaceError, NestedCDATAError, Node, NodeError, NodeNotFoundError, NodeSet, ParseError, ProcessingInstruction, SchemaValidationError, SecurityError, SerializationError, Text, UnbalancedTagError, UndefinedEntityError, ValidationError, VisitorError, VisitorMethodError, WriteError, XPathError

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.backendObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/moxml.rb', line 25

def backend
  @backend ||= begin
      backend_class = case config.backend
        when :nokogiri
          require_relative "moxml/backends/nokogiri"
          Backends::Nokogiri
        when :ox
          require_relative "moxml/backends/ox"
          Backends::Ox
        when :oga
          require_relative "moxml/backends/oga"
          Backends::Oga
        else
          raise ArgumentError, "Unknown backend: #{config.backend}"
        end
      backend_class.new
    end
end

.configObject



17
18
19
# File 'lib/moxml.rb', line 17

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



21
22
23
# File 'lib/moxml.rb', line 21

def configure
  yield(config)
end