本文整理汇总了Java中org.jruby.embed.ScriptingContainer.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java ScriptingContainer.setAttribute方法的具体用法?Java ScriptingContainer.setAttribute怎么用?Java ScriptingContainer.setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jruby.embed.ScriptingContainer
的用法示例。
在下文中一共展示了ScriptingContainer.setAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeJRubyRuntime
import org.jruby.embed.ScriptingContainer; //导入方法依赖的package包/类
private void initializeJRubyRuntime() {
container = new ScriptingContainer(org.jruby.embed.LocalContextScope.SINGLETHREAD);
if (jobConf != null) {
container.getLoadPaths().add(jobConf.get(CONF_JRB_LOAD_PATH));
}
if (rbScriptParam.startsWith(MODE_METHOD_MARK)) {
mode = MODE.METHOD;
evaluateMethod = rbScriptParam.substring(1);
container.setAttribute(AttributeName.SHARING_VARIABLES, false);
receiver = container.runScriptlet(rbEnvScript);
} else {
mode = MODE.EVAL;
evalUnit = container.parse(rbScriptParam);
}
LOG.info("initialized JRuby runtime (" +
container.getCompatVersion() + ", " +
container.getCompileMode()
+ ")");
}
示例2: initializeJRubyRuntime
import org.jruby.embed.ScriptingContainer; //导入方法依赖的package包/类
private void initializeJRubyRuntime() {
container = new ScriptingContainer(org.jruby.embed.LocalContextScope.SINGLETHREAD);
if (jobConf != null) {
container.getLoadPaths().add(jobConf.get(RubyScriptingUtils.CONF_JRB_LOAD_PATH));
}
container.setAttribute(AttributeName.SHARING_VARIABLES, false);
receiver = container.runScriptlet(rbEnvScript);
LOG.info("initialized JRuby runtime (" +
container.getCompatVersion() + ", " +
container.getCompileMode()
+ ")");
}