module Asciidoctor::Extensions::Treeprocessor::DSL

Internal: Overlays a builder DSL for configuring the Processor instance. Includes a method to define configuration options and another to define the {Processor#process} method.

Public Instance Methods

option(key, value) click to toggle source
# File lib/asciidoctor/extensions.rb, line 140
def option key, value
  config[key] = value
end
process(*args, &block) click to toggle source
# File lib/asciidoctor/extensions.rb, line 144
def process *args, &block
  # need to check for both block/proc and lambda
  # TODO need test for this!
  #if block_given? || (args.size == 1 && ::Proc === (block = args[0]))
  if block_given?
    @process_block = block
  elsif @process_block
    # NOTE Proc automatically expands a single array argument
    # ...but lambda doesn't (and we want to accept lambdas too)
    # TODO need a test for this!
    @process_block.call(*args)
  else
    raise ::NotImplementedError
  end
end
process_block_given?() click to toggle source

alias :process_with :process

# File lib/asciidoctor/extensions.rb, line 161
def process_block_given?
  defined? @process_block
end