Package org.jruby.runtime

Examples of org.jruby.runtime.ThreadContext


   
    @JRubyClass(name="NilClass")
    public static class YAMLNilMethods {
        @JRubyMethod(name = "to_yaml_node", required = 1)
        public static IRubyObject nil_to_yaml_node(IRubyObject self, IRubyObject arg) {
            ThreadContext context = self.getRuntime().getCurrentContext();
            return RuntimeHelpers.invoke(context, arg,"scalar", self.callMethod(context, "taguri"), self.getRuntime().newString(""), self.callMethod(context, "to_yaml_style"));
        }
View Full Code Here


     * Used by the RubyMethod#to_proc method.
     *
     */
    public static IRubyObject bmcall(IRubyObject blockArg, IRubyObject arg1,
            IRubyObject self, Block unusedBlock) {
        ThreadContext context = blockArg.getRuntime().getCurrentContext();
       
        if (blockArg instanceof RubyArray) {
            // ENEBO: Very wrong
            return ((RubyMethod) arg1).call(context, ((RubyArray) blockArg).toJavaArray(), Block.NULL_BLOCK);
        }
View Full Code Here

            context.getThread().afterBlockingCall();
        }
    }
   
    public IRubyObject read(IRubyObject[] args) {
        ThreadContext context = getRuntime().getCurrentContext();
       
        switch (args.length) {
        case 0: return read(context);
        case 1: return read(context, args[0]);
        case 2: return read(context, args[0], args[1]);
View Full Code Here

        }
        final Ruby runtime = this.runtime;
        try {
            safeInvokeAndWait(new Runnable() {
                public void run() {
                    ThreadContext context = runtime.getCurrentContext();
                    proc.call(context, args);
                }
            });
        } catch (InterruptedException e) {
        } catch (InvocationTargetException e) {
View Full Code Here

        if (paintProc != null) {
            if (priorGraphics != g) {
                wrappedGraphics = JavaUtil.convertJavaToUsableRubyObject(runtime, g);
                priorGraphics = g;
            }
            ThreadContext context = runtime.getCurrentContext();
            paintProc.call(context, new IRubyObject[] {wrappedGraphics});
        }
        super.paint(g);
    }
View Full Code Here

            this.thread = new Thread() {
                @Override
                public void run() {
                    synchronized (yieldLock) {
                        alive = true;
                        ThreadContext context = runtime.getCurrentContext();
                        context.setFiber(Fiber.this);
                        try {
                            result = Fiber.this.block.yield(runtime.getCurrentContext(), result, null, null, true);
                        } finally {
                            yieldLock.notify();
                        }
View Full Code Here

       
        RubyString version = runtime.newString("2.0.7 (JRuby 2007-05-11)");
        RubyString nkfVersion = runtime.newString("2.0.7");
        RubyString nkfDate = runtime.newString("2007-05-11");

        ThreadContext context = runtime.getCurrentContext();
       
        version.freeze(context);
        nkfVersion.freeze(context);
        nkfDate.freeze(context);
View Full Code Here

    public boolean isVerbose() {
        return runtime.getVerbose().isTrue();
    }

    public void warn(ID id, String message, Object... data) {
        ThreadContext context = runtime.getCurrentContext();
       
        warn(id, context.getFile(), context.getLine(), message, data);
    }
View Full Code Here

       
        warn(id, context.getFile(), context.getLine(), message, data);
    }

    public void warning(ID id, String message, Object... data) {
        ThreadContext context = runtime.getCurrentContext();

        warning(id, context.getFile(), context.getLine(), message, data);
    }
View Full Code Here

     *
     * @param script The scriptlet to run
     * @returns The result of the eval
     */
    public IRubyObject evalScriptlet(String script) {
        ThreadContext context = getCurrentContext();
        DynamicScope currentScope = context.getCurrentScope();
        ManyVarsDynamicScope newScope = new ManyVarsDynamicScope(new EvalStaticScope(currentScope.getStaticScope()), currentScope);
        Node node = parseEval(script, "<script>", newScope, 0);
       
        try {
            context.preEvalScriptlet(newScope);
            return node.interpret(this, context, context.getFrameSelf(), Block.NULL_BLOCK);
        } catch (JumpException.ReturnJump rj) {
            throw newLocalJumpError(RubyLocalJumpError.Reason.RETURN, (IRubyObject)rj.getValue(), "unexpected return");
        } catch (JumpException.BreakJump bj) {
            throw newLocalJumpError(RubyLocalJumpError.Reason.BREAK, (IRubyObject)bj.getValue(), "unexpected break");
        } catch (JumpException.RedoJump rj) {
            throw newLocalJumpError(RubyLocalJumpError.Reason.REDO, (IRubyObject)rj.getValue(), "unexpected redo");
        } finally {
            context.postEvalScriptlet();
        }
    }
View Full Code Here

TOP

Related Classes of org.jruby.runtime.ThreadContext

Copyright © 2018 www.massapicom. 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.