本文整理汇总了Java中org.jruby.RubyInstanceConfig.setLoader方法的典型用法代码示例。如果您正苦于以下问题:Java RubyInstanceConfig.setLoader方法的具体用法?Java RubyInstanceConfig.setLoader怎么用?Java RubyInstanceConfig.setLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jruby.RubyInstanceConfig
的用法示例。
在下文中一共展示了RubyInstanceConfig.setLoader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initRuntimeConfig
import org.jruby.RubyInstanceConfig; //导入方法依赖的package包/类
protected RubyInstanceConfig initRuntimeConfig(final RubyInstanceConfig config) {
final RackConfig rackConfig = rackServletContext.getConfig();
config.setLoader(Thread.currentThread().getContextClassLoader());
final Map<String, String> newEnv = rackConfig.getRuntimeEnvironment();
if (newEnv != null) {
config.setEnvironment(newEnv);
}
config.processArguments(rackConfig.getRuntimeArguments());
if (rackConfig.getCompatVersion() != null) {
config.setCompatVersion(rackConfig.getCompatVersion());
}
String home = getEnvVariable("JRUBY_HOME");
logger.info("stokesdrift.env JRUBY_HOME=" + home);
try {
if (home != null) {
config.setJRubyHome(home);
}
} catch (Exception e) {
rackServletContext.log(RackLogger.DEBUG, "won't set-up jruby.home from jar", e);
}
return config;
}
示例2: createRuntime
import org.jruby.RubyInstanceConfig; //导入方法依赖的package包/类
protected Ruby createRuntime(String root) {
Ruby runtime;
if (Ruby.isGlobalRuntimeReady()) {
runtime = Ruby.getGlobalRuntime();
} else {
RubyInstanceConfig instanceConfig = new RubyInstanceConfig();
String jrubyHome = WunderBoss.options().get("jruby-home", "").toString();
if (!jrubyHome.isEmpty()) {
instanceConfig.setJRubyHome(jrubyHome);
}
String[] argv = (String[]) WunderBoss.options().get("argv", new String[]{});
instanceConfig.setArgv(argv);
instanceConfig.setLoader(this.getClass().getClassLoader());
runtime = Ruby.newInstance(instanceConfig);
}
runtime.getLoadService().addPaths(root);
return runtime;
}
示例3: asciidoctor
import org.jruby.RubyInstanceConfig; //导入方法依赖的package包/类
@Bean
public Asciidoctor asciidoctor() {
RubyInstanceConfig rubyInstanceConfig = new RubyInstanceConfig();
rubyInstanceConfig.setLoader(this.getClass().getClassLoader());
JavaEmbedUtils.initialize(Arrays.asList("META-INF/jruby.home/lib/ruby/2.0", "classpath:/gems/asciidoctor-1.5.4/lib"), rubyInstanceConfig);
return create(this.getClass().getClassLoader());
}
示例4: init
import org.jruby.RubyInstanceConfig; //导入方法依赖的package包/类
public static void init()
{
if (instance != null) return;
instance = new ScriptExecuter();
Logger.log(ScriptExecuter.class, Logger.DEBUG, "ScriptExecuter starting...");
RubyInstanceConfig config = new RubyInstanceConfig();
config.setLoader(CuinaClassLoader.getInstance());
runtime = Ruby.newInstance(config);
runtime.getLoadService().require("java");
state = READY;
}