Examples of respondsTo()


Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

                            break;
                        case ClassIndex.STRING:
                            arg = ((RubyString)arg).stringToInum(0, true);
                            break;
                        default:
                            if (arg.respondsTo("to_int")) {
                                arg = TypeConverter.convertToType(arg, arg.getRuntime().getInteger(), "to_int", true);
                            } else {
                                arg = TypeConverter.convertToType(arg, arg.getRuntime().getInteger(), "to_i", true);
                            }
                            break;
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

                        buffer.putAddress(getAddress((Pointer) ptr));
                    } else if (ptr instanceof Buffer) {
                        addBufferParameter(buffer, ptr, flags);
                    } else if (ptr.isNil()) {
                        buffer.putAddress(0L);
                    } else if (depth < MAXRECURSE && ptr.respondsTo("to_ptr")) {
                        parameter = ptr;
                        continue;
                    } else {
                        throw context.getRuntime().newArgumentError("to_ptr returned an invalid pointer");
                    }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

                if (!vKlassName.isNil()) {
                    // might throw ArgumentError, we let it propagate
                    IRubyObject klass = parser.info.jsonModule.get().
                            callMethod(context, "deep_const_get", vKlassName);
                    if (klass.respondsTo("json_creatable?") &&
                        klass.callMethod(context, "json_creatable?").isTrue()) {

                        returnedResult = klass.callMethod(context, "json_create", result);
                    }
                }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

                            break;
                        case ClassIndex.STRING:
                            arg = ((RubyString)arg).stringToInum(0, true);
                            break;
                        default:
                            if (arg.respondsTo("to_int")) {
                                arg = TypeConverter.convertToType(arg, arg.getRuntime().getInteger(), "to_int", true);
                            } else {
                                arg = TypeConverter.convertToType(arg, arg.getRuntime().getInteger(), "to_i", true);
                            }
                            break;
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

    public static IRubyObject define_finalizer(IRubyObject recv, IRubyObject[] args, Block block) {
        Ruby runtime = recv.getRuntime();
        IRubyObject finalizer = null;
        if (args.length == 2) {
            finalizer = args[1];
            if (!finalizer.respondsTo("call")) {
                throw runtime.newArgumentError("wrong type argument "
                        + finalizer.getType() + " (should be callable)");
            }
        } else {
            finalizer = runtime.newProc(Block.Type.PROC, block);
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

                if (!vKlassName.isNil()) {
                    // might throw ArgumentError, we let it propagate
                    IRubyObject klass = parser.info.jsonModule.get().
                            callMethod(context, "deep_const_get", vKlassName);
                    if (klass.respondsTo("json_creatable?") &&
                        klass.callMethod(context, "json_creatable?").isTrue()) {

                        returnedResult = klass.callMethod(context, "json_create", result);
                    }
                }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

    }
   
    public static IRubyObject convert2ptr(ThreadContext context, IRubyObject parameter) {
        final int MAXRECURSE = 4;
        IRubyObject ptr = parameter;
        for (int i = 0; i < MAXRECURSE && !(ptr instanceof AbstractMemory) && ptr.respondsTo("to_ptr"); i++) {
            ptr = ptr.callMethod(context, "to_ptr");
        }

        return ptr;
    }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

            internalCtx.cert = cert.getAuxCert();
        }

        value = getInstanceVariable("@client_ca");
        if (value != null && !value.isNil()) {
            if (value.respondsTo("each")) {
                for (X509Cert ele : convertToX509Certs(value)) {
                    internalCtx.clientCa.add(ele.getAuxCert());
                }
            } else {
                Utils.checkKind(getRuntime(), value, "OpenSSL::X509::Certificate");
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

                if (!vKlassName.isNil()) {
                    // might throw ArgumentError, we let it propagate
                    IRubyObject klass = parser.info.jsonModule.get().
                            callMethod(context, "deep_const_get", vKlassName);
                    if (klass.respondsTo("json_creatable?") &&
                        klass.callMethod(context, "json_creatable?").isTrue()) {

                        returnedResult = klass.callMethod(context, "json_create", result);
                    }
                }
View Full Code Here

Examples of org.jruby.runtime.builtin.IRubyObject.respondsTo()

                        RubyScript.this.notifyAll();
                    }
                }
            }
        });
        if (fixture.respondsTo("test_setup")) {
            try {
                fixture.callMethod(interpreter.getCurrentContext(), "test_setup");
            } catch (Throwable t) {
                t.printStackTrace();
                throw new ScriptException(t.getMessage());
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.