Package org.jruby

Examples of org.jruby.IRuby.loadFile()


    public void test() {
        IRuby runtime = org.jruby.Ruby.getDefaultInstance();
        try {
            File f = new File(DATA + "snippets1.rb");
            runtime.loadFile(f, false);
            f = new File(DATA + "snippets2.rb");
            runtime.loadFile(f, false);
            IRubyObject rubyObject = runtime.evalScript("init");
            Assert.assertNotNull(rubyObject);
            rubyObject = runtime.evalScript("init");
View Full Code Here


        IRuby runtime = org.jruby.Ruby.getDefaultInstance();
        try {
            File f = new File(DATA + "snippets1.rb");
            runtime.loadFile(f, false);
            f = new File(DATA + "snippets2.rb");
            runtime.loadFile(f, false);
            IRubyObject rubyObject = runtime.evalScript("init");
            Assert.assertNotNull(rubyObject);
            rubyObject = runtime.evalScript("init");
            Assert.assertNotNull(rubyObject);
        } catch (Exception e) {
View Full Code Here

          // deprecated
            runtime.getGlobalVariables().set(GlobalVariable.variableName("ssh"), conn);
           
            runtime.getGlobalVariables().set(GlobalVariable.variableName("conn"), conn);
            runtime.getGlobalVariables().set(GlobalVariable.variableName("args"), JavaEmbedUtils.javaToRuby(runtime, args));
            runtime.loadFile(new File(filePath), false);
        } catch (JumpException je) {
            if (je.getJumpType() == JumpException.JumpType.RaiseJump) {
                RubyException raisedException = ((RaiseException)je).getException();

                if (raisedException.isKindOf(runtime.getClass("SystemExit"))) {
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.