本文整理汇总了Java中org.jruby.Ruby.setVerbose方法的典型用法代码示例。如果您正苦于以下问题:Java Ruby.setVerbose方法的具体用法?Java Ruby.setVerbose怎么用?Java Ruby.setVerbose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jruby.Ruby
的用法示例。
在下文中一共展示了Ruby.setVerbose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyStreams
import org.jruby.Ruby; //导入方法依赖的package包/类
/**
* applyStreams
*
* @param container
*/
protected void applyStreams()
{
Ruby runtime = this.getRuntime();
CommandContext context = this.getContext();
// turn off verbose mode (and warnings)
boolean isVerbose = runtime.isVerbose();
runtime.setVerbose(runtime.getNil());
// set stdin/out/err and console
this._oldReader = this.setReader(context.getInputStream());
this._oldWriter = this.setWriter(context.getOutputStream());
this._oldErrorWriter = this.setErrorWriter(context.getErrorStream());
this._oldConsole = this.setConsole(context.getConsoleStream());
// restore verbose mode
runtime.setVerbose((isVerbose) ? runtime.getTrue() : runtime.getFalse());
}
示例2: unapplyStreams
import org.jruby.Ruby; //导入方法依赖的package包/类
/**
* unapplyStreams
*/
protected void unapplyStreams()
{
Ruby runtime = this.getRuntime();
// turn off verbose mode (and warnings)
boolean isVerbose = runtime.isVerbose();
runtime.setVerbose(runtime.getNil());
// restore original values for STDIN/OUT/ERR
this.setReader(this._oldReader);
this.setWriter(this._oldWriter);
this.setErrorWriter(this._oldErrorWriter);
// remove CONSOLE/$console
if (this._oldConsole == null)
{
runtime.getObject().remove_const(runtime.getCurrentContext(), runtime.newString(CONSOLE_CONSTANT));
}
else
{
this.setConsole(this._oldConsole);
}
// restore verbose mode
runtime.setVerbose((isVerbose) ? runtime.getTrue() : runtime.getFalse());
}
示例3: setup
import org.jruby.Ruby; //导入方法依赖的package包/类
public static void setup(Ruby runtime) {
RubyModule bindex = runtime.defineModule("Bindex");
bindex.defineAnnotatedMethods(BindexMethods.class);
RubyClass exception = runtime.getException();
exception.defineAnnotatedMethods(ExceptionExtensionMethods.class);
IRubyObject verbose = runtime.getVerbose();
try {
runtime.setVerbose(runtime.getNil());
runtime.addEventHook(new SetExceptionBindingsEventHook());
} finally {
runtime.setVerbose(verbose);
}
}