module Asciidoctor::Converter::DefaultFactory

Mixed into the {Converter} module to provide the global registry of converters that are registered statically.

This registry includes built-in converters for {Html5Converter HTML 5}, {DocBook5Converter DocBook 5} and {ManPageConverter man(ual) page}, as well as any custom converters that have been discovered or explicitly registered. Converter registration is synchronized (where applicable) and is thus guaranteed to be thread safe.

Constants

PROVIDED

Private Instance Methods

catch_all() click to toggle source
# File lib/asciidoctor/converter.rb, line 333
def catch_all
  @@catch_all
end
for(backend) click to toggle source
# File lib/asciidoctor/converter.rb, line 315
def for backend
  @@registry.fetch backend do
    PROVIDED[backend] ? (@@mutex.synchronize do
      # require is thread-safe, so no reason to refetch
      require PROVIDED[backend]
      @@registry[backend]
    end) : catch_all
  end
end
register(converter, *backends) click to toggle source
# File lib/asciidoctor/converter.rb, line 300
def register converter, *backends
  if @@mutex.owned?
    backends.each {|backend| backend == '*' ? (@@catch_all = converter) : (@@registry = @@registry.merge backend => converter) }
  else
    @@mutex.synchronize { register converter, *backends }
  end
end
registry() click to toggle source
# File lib/asciidoctor/converter.rb, line 293
def registry
  @@registry
end
unregister_all() click to toggle source
# File lib/asciidoctor/converter.rb, line 308
def unregister_all
  @@mutex.synchronize do
    @@registry = @@registry.select {|backend| PROVIDED[backend] }
    @@catch_all = nil
  end
end