Jrubyscriptengine eval()

hi,

i am running jrubyscriptengine.eval() on a script which extends from
another script. how do i set the path for the script to locate its
parent with ‘require’.

The location of both the script and its parent will be known only at
runtime.

thanks
dixit

On Tue, May 18, 2010 at 7:38 AM, Dixit K. [email protected]
wrote:

i am running jrubyscriptengine.eval() on a script which extends from
another script. how do i set the path for the script to locate its
parent with ‘require’.

The location of both the script and its parent will be known only at
runtime.

ScriptingContainer’s setLoadPaths() method or evaluate the LOAD_PATH
would work.
For example,

String[] paths = {“/path/to/script”};
container.setLoadPaths(Arrays.asList(paths));

or

container.runScriptlet("$LOAD_PATH << " + location);

Hope this helps.
-Yoko


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thanks Yoko.

Another option that i was using is passing the load paths to the script
engine and later appending the path strings to the LOAD_PATH inside the
script before any require statements.