Examples of convertToInteger()


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

            // try to get errno out of the class
            err = klass.fastGetConstant("Errno");
        }
       
        if (!err.isNil()) {
            errno = err.convertToInteger();
        }

        String val = defaultMessages.get(klass.getName());
        if (val == null) {
            val = "Unknown error";
View Full Code Here

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

        }

        String val = null;

        if (!err.isNil()) {
            errno = err.convertToInteger();
            int errnoVal = RubyNumeric.num2int(errno);
            if (Errno.valueOf(errnoVal) != Errno.__UNKNOWN_CONSTANT__) {
                // we got a valid errno value
                isErrnoClass = true;
                setMetaClass(runtime.getErrno(errnoVal));
View Full Code Here

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

    }

    protected int write(CallSite write, ByteBuffer src) throws IOException {
        ByteList buffer = new ByteList(src.array(), src.position(), src.remaining(), false);
        IRubyObject written = write.call(io.getRuntime().getCurrentContext(), io, io, RubyString.newStringLight(io.getRuntime(), buffer));
        return (int)written.convertToInteger().getLongValue();
    }

    protected CallSite initReadSite() {
        if(io.respondsTo("read")) {
            return MethodIndex.getFunctionalCallSite("read");
View Full Code Here

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

    private void aggregateDimensions(IRubyObject[] sizes) {
        int[] newDimensions = new int[dimensions.length + sizes.length];
        System.arraycopy(dimensions, 0, newDimensions, 0, dimensions.length);
        for (int i = 0; i < sizes.length; i++) {
            IRubyObject size = sizes[i];
            int intSize = (int) size.convertToInteger().getLongValue();
            newDimensions[i + dimensions.length] = intSize;
        }
        dimensions = newDimensions;
    }
}
View Full Code Here

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

                tag.isNil() ? null : tag.asJavaString(),
                new ImplicitTuple(plain.isTrue(),
                quoted.isTrue()),
                value.asJavaString(),
                NULL_MARK,
                NULL_MARK, (char)style.convertToInteger().getLongValue());
        emit(context, event);
        return this;
    }

    @JRubyMethod(required = 4)
View Full Code Here

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

                anchor.isNil() ? null : anchor.asJavaString(),
                tag.isNil() ? null : tag.asJavaString(),
                implicit.isTrue(),
                NULL_MARK,
                NULL_MARK,
                style.convertToInteger().getLongValue() == 0);
        emit(context, event);
        return this;
    }

    @JRubyMethod
View Full Code Here

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

                anchor.isNil() ? null : anchor.asJavaString(),
                tag.isNil() ? null : tag.asJavaString(),
                implicit.isTrue(),
                NULL_MARK,
                NULL_MARK,
                style.convertToInteger().getLongValue() == 0);
        emit(context, event);
        return this;
    }

    @JRubyMethod
View Full Code Here

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

        }

        String val = null;

        if (!err.isNil()) {
            errno = err.convertToInteger();
            int errnoVal = RubyNumeric.num2int(errno);
            if (Errno.valueOf(errnoVal) != Errno.__UNKNOWN_CONSTANT__) {
                // we got a valid errno value
                isErrnoClass = true;
View Full Code Here

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

        if (arg instanceof RubyRange) {
            return randomRand(context, arg, random);
        }

        RubyInteger max = arg.convertToInteger();
        return randCommon(context, random, max);
    }

    // c: rb_f_rand for 1.8
    public static IRubyObject randCommon18(ThreadContext context, IRubyObject recv,
View Full Code Here

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

        IRubyObject level     = rbOptions.callMethod(context, "indentation");

        options = new DumperOptions();

        options.setCanonical(canonical.isTrue());
        options.setIndent((int)level.convertToInteger().getLongValue());
        options.setWidth((int)width.convertToInteger().getLongValue());

        this.io = io;

        return context.nil;
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.