本文整理匯總了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()
+ ")");
}