[jruby] runScriptlet return value question (documentation is unclear)

changepoint_advi.fischer at extaccount.com changepoint_advi.fischer at extaccount.com
Tue Jan 5 23:48:00 JST 2016

I find the documentation of ScriptingContainer.runScriptlet a bit unclear. It says:

   public Object runScriptlet(String script)

   Evaluates a script under the current scope (perhaps the top-level scope) and returns a result only if a script returns a value. Right after the parsing, the script is evaluated once.

How is the wording  "returns a result only if a script returns a value" to be understood?

(1) "if a script returns a value" -> Since every Ruby Script returns a value (even if the value is nil), I guess this means "if the script can't be executed". Right?

(2) "returns a result only" -> Does it mean, that, if (1) does not happen (i.e. error when running the script, or whatever), null is returned, or is it meant that some RuntimeException is thrown?


If you are not the addressee, please inform us immediately that you have received this e-mail by mistake, and delete it. We thank you for your support.

More information about the JRuby mailing list