Examples of ThreadContext


Examples of org.jruby.runtime.ThreadContext

     *
     * The internal helper method that takes care of the part of the
     * inspection that inspects instance variables.
     */
    private StringBuilder inspectObj(StringBuilder part) {
        ThreadContext context = getRuntime().getCurrentContext();
        String sep = "";
       
        for (Variable<IRubyObject> ivar : getInstanceVariableList()) {
            part.append(sep).append(" ").append(ivar.getName()).append("=");
            part.append(ivar.getValue().callMethod(context, "inspect"));
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

        // Make sure all arguments are modules before calling the callbacks
        for (int i = 0; i < args.length; i++) {
            if (!args[i].isModule()) throw runtime.newTypeError(args[i], runtime.getModule());
        }

        ThreadContext context = runtime.getCurrentContext();
               
        // MRI extends in order from last to first
        for (int i = args.length - 1; i >= 0; i--) {
            args[i].callMethod(context, "extend_object", this);
            args[i].callMethod(context, "extended", this);
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

        }
    }

    // TODO: Only used by interface implementation; eliminate it
    public static IRubyObject invokeMethodMissing(IRubyObject receiver, String name, IRubyObject[] args) {
        ThreadContext context = receiver.getRuntime().getCurrentContext();

        // store call information so method_missing impl can use it
        context.setLastCallStatusAndVisibility(CallType.FUNCTIONAL, Visibility.PUBLIC);

        if (name == "method_missing") {
            return RubyKernel.method_missing(context, receiver, args, Block.NULL_BLOCK);
        }
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

            return newInstance(getRuntime().fastGetClass("BigDecimal"),new IRubyObject[]{getRuntime().newString(s)});
        }
        if(must) {
            String err;
            if (isImmediate()) {
                ThreadContext context = getRuntime().getCurrentContext();
                err = inspect(context, this).toString();
            } else {
                err = getMetaClass().getBaseName();
            }
            throw getRuntime().newTypeError(err + " can't be coerced into BigDecimal");
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

        POSIX posix = runtime.getPosix();
        try {
            // call getpwent to fail early if unsupported
            posix.getpwent();
            if(block.isGiven()) {
                ThreadContext context = runtime.getCurrentContext();
                posix.setpwent();
                Passwd pw;
                while((pw = posix.getpwent()) != null) {
                    block.yield(context, setupPasswd(runtime, pw));
                }
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

        POSIX posix = runtime.getPosix();
        try {
            // try to read grent to fail fast
            posix.getgrent();
            if(block.isGiven()) {
                ThreadContext context = runtime.getCurrentContext();
                posix.setgrent();
                Group gr;
                while((gr = posix.getgrent()) != null) {
                    block.yield(context, setupGroup(runtime, gr));
                }
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

            this.signal_object = signal_object;
            this.signal = signal;
        }

        public void handle(Signal signal) {
            ThreadContext context = runtime.getCurrentContext();
            try {
                block.callMethod(context, "call");
            } catch(RaiseException e) {
                try {
                    runtime.getThread().callMethod(context, "main")
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

                throw runtime.newNameError("identifier " + name + " needs to be constant", name);
            }

            IRubyObject type = superClass.getConstantAt(name);
            if (type != null) {
                ThreadContext context = runtime.getCurrentContext();
                Frame frame = context.getCurrentFrame();
                runtime.getWarnings().warn(ID.STRUCT_CONSTANT_REDEFINED, frame.getFile(), frame.getLine(), "redefining constant Struct::" + name, name);
                superClass.remove_const(context, runtime.newString(name));
            }
            newStruct = superClass.defineClassUnder(name, superClass, STRUCT_INSTANCE_ALLOCATOR);
        }
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

    public static Object convertRubyToJava(IRubyObject rubyObject, Class javaClass) {
        if (javaClass == void.class || rubyObject == null || rubyObject.isNil()) {
            return null;
        }
       
        ThreadContext context = rubyObject.getRuntime().getCurrentContext();
       
        if (rubyObject.dataGetStruct() instanceof JavaObject) {
            rubyObject = (JavaObject) rubyObject.dataGetStruct();
        } else if (rubyObject.respondsTo("java_object")) {
            rubyObject = rubyObject.callMethod(context, "java_object");
View Full Code Here

Examples of org.jruby.runtime.ThreadContext

        runtime.getLoadService().smartLoad("builtin/javasupport");
        RubyClassPathVariable.createClassPathVariable(runtime);
    }

    public static RubyModule createJavaModule(Ruby runtime) {
        ThreadContext context = runtime.getCurrentContext();
        RubyModule javaModule = runtime.defineModule("Java");
       
        javaModule.defineAnnotatedMethods(Java.class);

        JavaObject.createJavaObjectClass(runtime, javaModule);
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.