Examples of convertToInteger()


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

                ptrname = args[1];
                whence = interpretSeekWhence(ptrname);
            case 1:
                offset = args[0];
        }
        pos = offset.convertToInteger().getLongValue();
        fptr = getOpenFileChecked();

        boolean locked = fptr.lock();
        try {
            if ((fptr.isReadable()) &&
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()

        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

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

                new ImplicitTuple(plain.isTrue(),
                quoted.isTrue()),
                value.asJavaString(),
                NULL_MARK,
                NULL_MARK,
                SCALAR_STYLES[(int)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,
                SEQUENCE_BLOCK != style.convertToInteger().getLongValue());
        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,
                MAPPING_BLOCK != style.convertToInteger().getLongValue());
        emit(context, event);
        return this;
    }

    @JRubyMethod
View Full Code Here

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

            IRubyObject cmp = invokedynamic(getRuntime().getCurrentContext(),
                    this, OP_CMP, other);
           
            // if RubyBasicObject#op_cmp is used, the result may be nil
            if (!cmp.isNil()) {
                return (int) cmp.convertToInteger().getLongValue();
            }
        } catch (RaiseException ex) {
            // runtime.getGlobalVariables().set("$!", oldExc);
        }
       
View Full Code Here

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

        if (timeout.isNil()) {
            tv = 0;
        }
        else {
            tv = timeout.convertToInteger().getLongValue() * 1000;
        }

        if (fptr.readPending() != 0) return runtime.getTrue();
        // TODO: better effort to get available bytes from our channel
//        if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qfalse;
View Full Code Here

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

        }
        if (timeout.isNil()) {
            tv = 0;
        }
        else {
            tv = timeout.convertToInteger().getLongValue() * 1000;
        }

        i = fptr.waitWritable(context, tv);
        fptr.checkClosed();
        if (i)
View Full Code Here

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

                        } else { // Date, DateTime
                            int prec = width - 3;
                            IRubyObject power = context.runtime.newFixnum(10).callMethod("**", context.runtime.newFixnum(prec));
                            IRubyObject truncated = sub_millis.callMethod(context, "numerator").callMethod(context, "*", power);
                            truncated = truncated.callMethod(context, "/", sub_millis.callMethod(context, "denominator"));
                            long decimals = truncated.convertToInteger().getLongValue();
                            output += RubyTimeOutputFormatter.formatNumber(decimals, prec, '0');
                        }
                    }

                    if (width < output.length()) {
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.