本文整理了Java中org.jruby.Ruby.runFromMain
方法的一些代码示例,展示了Ruby.runFromMain
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.runFromMain
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:runFromMain
[英]Run the script contained in the specified input stream, using the specified filename as the name of the script being executed. The stream will be read fully before being parsed and executed. The given filename will be used for the ruby $PROGRAM_NAME and $0 global variables in this runtime. This method is intended to be called once per runtime, generally from Main or from main-like top-level entry points. As part of executing the script loaded from the input stream, various RubyInstanceConfig properties will be used to determine whether to compile the script before execution or run with various wrappers (for looping, printing, and so on, see jruby -help).
[中]使用指定的文件名作为正在执行的脚本的名称,运行指定输入流中包含的脚本。流在被解析和执行之前将被完全读取。给定的文件名将用于此运行时中的ruby$PROGRAM_名称和$0全局变量。此方法旨在每个运行时调用一次,通常从Main或类似Main的顶级入口点调用。作为执行从输入流加载的脚本的一部分,将使用各种RubyInstanceConfig属性来确定是在执行之前编译脚本,还是使用各种包装器运行脚本(有关循环、打印等,请参阅jruby-help)。
代码示例来源:origin: org.jruby/jruby-complete
private Status doRunFromMain(Ruby runtime, InputStream in, String filename) {
try {
doCheckSecurityManager();
runtime.runFromMain(in, filename);
} catch (RaiseException rj) {
return new Status(handleRaiseException(rj));
}
return new Status();
}
代码示例来源:origin: org.jruby/jruby-core
private Status doRunFromMain(Ruby runtime, InputStream in, String filename) {
try {
doCheckSecurityManager();
runtime.runFromMain(in, filename);
} catch (RaiseException rj) {
return new Status(handleRaiseException(rj));
}
return new Status();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private Status doRunFromMain(Ruby runtime, InputStream in, String filename) {
long now = -1;
try {
doCheckSecurityManager();
runtime.runFromMain(in, filename);
} catch (RaiseException rj) {
return new Status(handleRaiseException(rj));
}
return new Status();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private Status doRunFromMain(Ruby runtime, InputStream in, String filename) {
long now = -1;
try {
doCheckSecurityManager();
runtime.runFromMain(in, filename);
} catch (RaiseException rj) {
return new Status(handleRaiseException(rj));
}
return new Status();
}
内容来源于网络,如有侵权,请联系作者删除!