Module: Asciidoctor::Extensions::IncludeProcessorDsl

Includes:
DocumentProcessorDsl
Defined in:
lib/asciidoctor/extensions.rb

Instance Method Summary collapse

Methods included from DocumentProcessorDsl

#prefer

Instance Method Details

#handles?(*args, &block) ⇒ Boolean

Returns:

  • (Boolean)


460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/asciidoctor/extensions.rb', line 460

def handles? *args, &block
  if block_given?
    raise ::ArgumentError, %(wrong number of arguments (given #{args.size}, expected 0)) unless args.empty?
    @handles_block = block
  # TODO enable if we want to support passing proc or lambda as argument instead of block
  #elsif ::Proc === args[0]
  #  block = args.shift
  #  raise ::ArgumentError, %(wrong number of arguments (given #{args.size}, expected 0)) unless args.empty?
  #  @handles_block = block
  elsif defined? @handles_block
    @handles_block.call args[0]
  else
    true
  end
end