@Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "inline_macro", new IRubyObject[]{rubyClass, rubyRuntime.newSymbol(inlineMacroProcessor.getName())}); } });
RubyHash rubyConfig = RubyHashUtil.convertMapToRubyHashWithSymbols(getRuntime(), getProcessor().getConfig()); Object regexp = getProcessor().getConfig().get("regexp"); if (regexp != null && regexp instanceof CharSequence) { RubySymbol regexpSymbol = RubySymbol.newSymbol(getRuntime(), "regexp"); String macroName = explicitMacroName != null ? explicitMacroName : getProcessor().getName(); getProcessor().setName(explicitMacroName); } else if (getProcessor().getName() == null) { RubyHash config = (RubyHash) this.callMethod(context, "config"); Object rubyName = config.get(context.getRuntime().newSymbol("name")); if (rubyName != null) { getProcessor().setName(rubyName.toString()); getProcessor().updateConfig(new RubyHashMapDecorator((RubyHash) getInstanceVariable(MEMBER_NAME_CONFIG))); } else { getProcessor().setName(explicitMacroName); RubyHash config = RubyHashUtil.convertMapToRubyHashWithSymbols(context.getRuntime(), getProcessor().getConfig()); getProcessor().setConfig(new RubyHashMapDecorator((RubyHash) getInstanceVariable(MEMBER_NAME_CONFIG)));
@JRubyMethod(name = "process", required = 3) public IRubyObject process(ThreadContext context, IRubyObject parent, IRubyObject target, IRubyObject attributes) { Object o = getProcessor().process( NodeConverter.createASTNode(parent), RubyUtils.rubyToJava(getRuntime(), target, String.class), new RubyAttributesMapDecorator((RubyHash) attributes)); return convertProcessorResult(o); }
RubyHash rubyConfig = RubyHashUtil.convertMapToRubyHashWithSymbols(getRuntime(), getProcessor().getConfig()); Object regexp = getProcessor().getConfig().get("regexp"); if (regexp != null && regexp instanceof CharSequence) { RubySymbol regexpSymbol = RubySymbol.newSymbol(getRuntime(), "regexp"); String macroName = explicitMacroName != null ? explicitMacroName : getProcessor().getName(); getProcessor().setName(explicitMacroName); } else if (getProcessor().getName() == null) { RubyHash config = (RubyHash) this.callMethod(context, "config"); Object rubyName = config.get(context.getRuntime().newSymbol("name")); if (rubyName != null) { getProcessor().setName(rubyName.toString()); getProcessor().updateConfig(new RubyHashMapDecorator((RubyHash) getInstanceVariable(MEMBER_NAME_CONFIG))); } else { getProcessor().setName(explicitMacroName); RubyHash config = RubyHashUtil.convertMapToRubyHashWithSymbols(context.getRuntime(), getProcessor().getConfig()); getProcessor().setConfig(new RubyHashMapDecorator((RubyHash) getInstanceVariable(MEMBER_NAME_CONFIG)));
@JRubyMethod(name = "process", required = 3) public IRubyObject process(ThreadContext context, IRubyObject parent, IRubyObject target, IRubyObject attributes) { Object o = getProcessor().process( NodeConverter.createASTNode(parent), RubyUtils.rubyToJava(getRuntime(), target, String.class), new RubyAttributesMapDecorator((RubyHash) attributes)); return convertProcessorResult(o); }
@Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "inline_macro", new IRubyObject[]{rubyClass, rubyRuntime.newSymbol(inlineMacroProcessor.getName())}); } });