Java Code Examples for org.jruby.Ruby#isVerbose()

The following examples show how to use org.jruby.Ruby#isVerbose() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandBlockRunner.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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());
}
 
Example 2
Source File: CommandBlockRunner.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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());
}