module Asciidoctor::Converter::Config

A module that provides the {#register_for} method for statically registering a converter with the default {Factory Converter::Factory} instance.

Public Instance Methods

register_for(*backends) click to toggle source

Public: Statically registers the current {Converter} class with the default {Factory Converter::Factory} to handle conversion to the specified backends.

This method also defines the converts? method on the class which returns whether the class is registered to convert a specified backend.

backends - A String Array of backends with which to associate this {Converter} class.

Returns nothing

# File lib/asciidoctor/converter.rb, line 54
def register_for *backends
  Factory.register self, backends
  metaclass = class << self; self; end
  if backends == ['*']
    metaclass.send :define_method, :converts? do |name|
      true
    end
  else
    metaclass.send :define_method, :converts? do |name|
      backends.include? name
    end
  end
  nil
end