Package org.jruby.embed

Examples of org.jruby.embed.EmbedEvalUnit.run()


    public void testConstantCompilation(){
        ScriptingContainer c = new ScriptingContainer(LocalContextScope.SINGLETHREAD, LocalVariableBehavior.PERSISTENT);
        c.setCompatVersion(CompatVersion.RUBY1_8);
        c.setCompileMode(CompileMode.FORCE);
        EmbedEvalUnit unit = c.parse("RUBY_VERSION", 0);
        assertEquals("1.8.7", unit.run().toString());
    }
}
View Full Code Here


        }
        container.setScriptFilename(Utils.getFilename(context));
        try {
            Utils.preEval(container, context);
            EmbedEvalUnit unit = container.parse(script, Utils.getLineNumber(context));
            IRubyObject ret = unit.run();
            return JavaEmbedUtils.rubyToJava(ret);
        } catch (Exception e) {
            throw wrapException(e);
        } finally {
            Utils.postEval(container, context);
View Full Code Here

        }
        String filename = Utils.getFilename(context);
        try {
            Utils.preEval(container, context);
            EmbedEvalUnit unit = container.parse(reader, filename, Utils.getLineNumber(context));
            IRubyObject ret = unit.run();
            return JavaEmbedUtils.rubyToJava(ret);
        } catch (Exception e) {
            throw wrapException(e);
        } finally {
            Utils.postEval(container, context);
View Full Code Here

            if (Utils.isClearVariablesOn(context)) {
                container.clear();
            }
            Utils.preEval(container, context);
            EmbedEvalUnit unit = container.parse(script, Utils.getLineNumber(context));
            IRubyObject ret = unit.run();
            return JavaEmbedUtils.rubyToJava(ret);
        } catch (Exception e) {
            throw wrapException(e);
        } finally {
            Utils.postEval(container, context);
View Full Code Here

            if (Utils.isClearVariablesOn(context)) {
                container.clear();
            }
            Utils.preEval(container, context);
            EmbedEvalUnit unit = container.parse(reader, filename, Utils.getLineNumber(context));
            IRubyObject ret = unit.run();
            return JavaEmbedUtils.rubyToJava(ret);
        } catch (Exception e) {
            throw wrapException(e);
        } finally {
            Utils.postEval(container, context);
View Full Code Here

            if (Utils.isClearVariablesOn(context)) {
                container.clear();
            }
            Utils.preEval(container, context);
            EmbedEvalUnit unit = container.parse(script, Utils.getLineNumber(context));
            IRubyObject ret = unit.run();
            return JavaEmbedUtils.rubyToJava(ret);
        } catch (Exception e) {
            throw wrapException(e);
        } finally {
            Utils.postEval(container, context);
View Full Code Here

            if (Utils.isClearVariablesOn(context)) {
                container.clear();
            }
            Utils.preEval(container, context);
            EmbedEvalUnit unit = container.parse(reader, filename, Utils.getLineNumber(context));
            IRubyObject ret = unit.run();
            return JavaEmbedUtils.rubyToJava(ret);
        } catch (Exception e) {
            throw wrapException(e);
        } finally {
            Utils.postEval(container, context);
View Full Code Here

        try {
            // run init script
            runResourceScript(runtime, initScript);

            final EmbedEvalUnit eval = runtime.parse(PathType.RELATIVE, file.getPath());
            /*IRubyObject res =*/ eval.run();

            // create plugin description
            final PluginDescriptionFile description = getDescriptionFile(runtime);
            if (description == null)
                return null;    // silent fail if the script doesn't contain a plugin description
View Full Code Here

        try {
            // run init script
            runResourceScript(runtime, initScript);

            final EmbedEvalUnit eval = runtime.parse(PathType.RELATIVE, file.getPath());
            /*IRubyObject res =*/ eval.run();

            return getDescriptionFile(runtime);

        } catch (IOException e) {
            throw new InvalidDescriptionException(e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.