class Asciidoctor::Converter::CompositeConverter
identifies itself as the handler for a given transform.
objects passed to the constructor. Selects the first {Converter} that
A {Converter} implementation that delegates to the chain of {Converter}
def convert node, transform = nil, opts = nil
opts - an optional Hash that is passed to the delegate's convert method. (default: nil)
transform is specified. (default: nil)
transform - the optional String transform, or the name of the node if no
node - the AbstractNode to convert
option to the delegate's convert method.
handler for the given transform. The optional Hash is passed as the last
Public: Delegates to the first converter that identifies itself as the
def convert node, transform = nil, opts = nil (converter_for transform ||= node.node_name).convert node, transform, opts end
def converter_for transform
Public: Retrieve the converter for the specified transform.
def converter_for transform @converter_cache[transform] end
def find_converter transform
Raise an exception if no converter is found.
Public: Find the converter for the specified transform.
def find_converter transform @converters.each {|candidate| return candidate if candidate.handles? transform } raise %(Could not find a converter to handle transform: #{transform}) end
def initialize backend, *converters, backend_traits_source: nil
def initialize backend, *converters, backend_traits_source: nil @backend = backend (@converters = converters).each {|converter| converter.composed self if converter.respond_to? :composed } init_backend_traits backend_traits_source.backend_traits if backend_traits_source @converter_cache = ::Hash.new {|hash, key| hash[key] = find_converter key } end