@Override public void unregister() { asciidoctorModule .callMethod("unregister_extension", rubyRuntime.newString(this.groupName)); }
@Override public RubyExtensionRegistryImpl includeProcessor(String includeProcessor) { getAsciidoctorModule().callMethod( "include_processor", rubyRuntime.newString(includeProcessor)); return this; }
@Override public JavaExtensionRegistry docinfoProcessor(Class<? extends DocinfoProcessor> docInfoProcessor) { RubyClass rubyClass = DocinfoProcessorProxy.register(rubyRuntime, docInfoProcessor); getAsciidoctorModule().callMethod("docinfo_processor", rubyClass); return this; }
@Override public JavaExtensionRegistry preprocessor(Preprocessor preprocessor) { RubyClass rubyClass = PreprocessorProxy.register(rubyRuntime, preprocessor); getAsciidoctorModule().callMethod("preprocessor", rubyClass); return this; }
@Override public JavaExtensionRegistry blockMacro(BlockMacroProcessor blockMacroProcessor) { RubyClass rubyClass = BlockMacroProcessorProxy.register(rubyRuntime, blockMacroProcessor); getAsciidoctorModule().callMethod("block_macro", rubyClass); return this; }
@Override public RubyExtensionRegistryImpl docinfoProcessor(String docinfoProcessor) { getAsciidoctorModule().callMethod( "docinfo_processor", rubyRuntime.newString(docinfoProcessor)); return this; }
@Override public RubyExtensionRegistryImpl inlineMacro(String inlineMacroProcessor) { getAsciidoctorModule().callMethod( "inline_macro", rubyRuntime.newString(inlineMacroProcessor)); return this; }
@Override public JavaExtensionRegistry postprocessor(Postprocessor postprocessor) { RubyClass rubyClass = PostprocessorProxy.register(asciidoctor, postprocessor); getAsciidoctorModule().callMethod("postprocessor", rubyClass); return this; }
@Override public JavaExtensionRegistry includeProcessor(IncludeProcessor includeProcessor) { RubyClass rubyClass = IncludeProcessorProxy.register(asciidoctor, includeProcessor); getAsciidoctorModule().callMethod("include_processor", rubyClass); return this; }
@Override public JavaExtensionRegistry blockMacro(BlockMacroProcessor blockMacroProcessor) { RubyClass rubyClass = BlockMacroProcessorProxy.register(asciidoctor, blockMacroProcessor); getAsciidoctorModule().callMethod("block_macro", rubyClass); return this; }
@Override public JavaExtensionRegistry blockMacro(String macroName, BlockMacroProcessor blockMacroProcessor) { RubyClass rubyClass = BlockMacroProcessorProxy.register(asciidoctor, blockMacroProcessor); getAsciidoctorModule().callMethod("block_macro", rubyClass, rubyRuntime.newString(macroName)); return this; }
@Override public RubyExtensionRegistryImpl inlineMacro(String blockName, String inlineMacroProcessor) { getAsciidoctorModule().callMethod( "inline_macro", rubyRuntime.newString(inlineMacroProcessor), RubyUtils.toSymbol(rubyRuntime, blockName)); return this; }
public final IRubyObject getConstant(ThreadContext context, StaticScope scope, String name, int index) { IRubyObject value = getValue(context, scope, name, index); // We can callsite cache const_missing if we want return value != null ? value : scope.getModule().callMethod(context, "const_missing", context.runtime.fastNewSymbol(name)); }
@Override public JavaExtensionRegistry blockMacro(String macroName, BlockMacroProcessor blockMacroProcessor) { RubyClass rubyClass = BlockMacroProcessorProxy.register(rubyRuntime, blockMacroProcessor); getAsciidoctorModule().callMethod("block_macro", rubyClass, rubyRuntime.newString(macroName)); return this; }
@Override public JavaExtensionRegistry blockMacro(String blockName, Class<? extends BlockMacroProcessor> blockMacroProcessor) { RubyClass rubyClass = BlockMacroProcessorProxy.register(asciidoctor, blockMacroProcessor); getAsciidoctorModule().callMethod("block_macro", rubyClass, rubyRuntime.newString(blockName)); return this; }
@Override public JavaExtensionRegistry inlineMacro(String macroName, Class<? extends InlineMacroProcessor> inlineMacroProcessor) { RubyClass rubyClass = InlineMacroProcessorProxy.register(asciidoctor, inlineMacroProcessor); getAsciidoctorModule().callMethod("inline_macro", rubyClass, rubyRuntime.newString(macroName)); return this; }
@SuppressWarnings("unchecked") @Override public DocumentHeader readDocumentHeader(File filename) { RubyHash rubyHash = getParseHeaderOnlyOption(); Document document = (Document) NodeConverter.createASTNode(getAsciidoctorModule().callMethod("load_file", rubyRuntime.newString(filename.getAbsolutePath()), rubyHash)); return toDocumentHeader(document); }
@Override public JavaExtensionRegistry inlineMacro(Class<? extends InlineMacroProcessor> inlineMacroProcessor) { String name = getName(inlineMacroProcessor); RubyClass rubyClass = InlineMacroProcessorProxy.register(asciidoctor, inlineMacroProcessor); getAsciidoctorModule().callMethod("inline_macro", rubyClass, rubyRuntime.newString(name)); return this; }
@Override public void register() { IRubyObject callback = extensionGroupClass.newInstance(rubyRuntime.getCurrentContext(), Block.NULL_BLOCK); asciidoctorModule.callMethod("register_extension_group", rubyRuntime.newString(this.groupName), callback, JavaEmbedUtils.javaToRuby(rubyRuntime, registrators)); }
@JRubyMethod(name = "alias_method", required = 2) public RubyModule alias_method(ThreadContext context, IRubyObject newId, IRubyObject oldId) { RubySymbol newSym = TypeConverter.checkID(newId); RubySymbol oldSym = TypeConverter.checkID(oldId); // MRI uses rb_to_id but we return existing symbol defineAlias(newSym.idString(), oldSym.idString()); if (isSingleton()) { ((MetaClass) this).getAttached().callMethod(context, "singleton_method_added", newSym); } else { callMethod(context, "method_added", newSym); } return this; }