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
transform is specified. (default: nil)
transform - the optional String transform, or the name of the node if no
node - the AbstractNode to convert
handler for the given transform.
Public: Delegates to the first converter that identifies itself as the
def convert node, transform = nil transform ||= node.node_name # QUESTION is there a way we can control whether to use convert or send? (converter_for transform).convert node, transform end
def convert_with_options node, transform = nil, opts = {}
opts - a optional Hash that is passed to the delegate's convert method. (default: {})
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_with_options node, transform = nil, opts = {} transform ||= node.node_name # QUESTION should we check arity, or perhaps do a rescue ::ArgumentError? (converter_for transform).convert_with_options node, transform, opts end
def converter_for transform
Public: Retrieve the converter for the specified transform.
def converter_for transform @converter_map[transform] ||= find_converter transform end
def find_converter transform
Raise an exception if no converter is found.
Internal: Find the converter for the specified transform.
def find_converter transform @converters.each do |candidate| return candidate if candidate.handles? transform end raise %(Could not find a converter to handle transform: #{transform}) end
def initialize backend, *converters
def initialize backend, *converters @backend = backend (@converters = converters.flatten.compact).each do |converter| converter.composed self if converter.respond_to? :composed end @converter_map = {} end