Class: Moxml::Adapter::Libxml::EntityRestorer

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/adapter/libxml/entity_restorer.rb

Overview

Restores configured character entities into explicit Moxml EntityReference nodes after LibXML has parsed the native tree.

Instance Method Summary collapse

Constructor Details

#initialize(doc, adapter: Libxml) ⇒ EntityRestorer

Returns a new instance of EntityRestorer.



9
10
11
12
13
14
15
# File 'lib/moxml/adapter/libxml/entity_restorer.rb', line 9

def initialize(doc, adapter: Libxml)
  @doc = doc
  @ctx = doc.context
  @registry = @ctx.entity_registry
  @config = @ctx.config
  @adapter = adapter
end

Instance Method Details

#runObject



17
18
19
20
21
# File 'lib/moxml/adapter/libxml/entity_restorer.rb', line 17

def run
  return unless @registry && @doc.root

  walk(@doc.root)
end