Package org.jruby

Examples of org.jruby.Ruby.newFixnum()


      RubyClass messageClass = loggerClass.getClass("Message");

      IRubyObject loggerMsg  = messageClass.newInstance(runtime.getCurrentContext(),
          runtime.newString(logMessage),    // query
          runtime.newString(""),            // start
          runtime.newFixnum(executionTime), // duration
          Block.NULL_BLOCK);

      api.callMethod(connection_instance, "log", loggerMsg);
    }
View Full Code Here


            Ruby runtime = context.runtime;
            if (!(recv instanceof RubyString)) {
                throw runtime.newTypeError(recv, runtime.getString());
            }

            return runtime.newFixnum(((RubyString)recv).unseededStrHashCode(runtime));
        }
    }
}
View Full Code Here

        ByteList bytes = data.internal.getByteList();

        // Check the length every iteration, since
        // the block can modify this string.
        while (data.pos < bytes.length()) {
            block.yield(context, runtime.newFixnum(bytes.get((int) data.pos++) & 0xFF));
        }
        return this;
    }

    @JRubyMethod(name = "each_byte")
View Full Code Here

                .append(val.get(6)&0xff)
                .append(".")
                .append(val.get(7)&0xff);

        IRubyObject[] result = new IRubyObject[]{
                runtime.newFixnum(port),
                runtime.newString(sb.toString())};

        return runtime.newArrayNoCopy(result);
    }
View Full Code Here

                    }
                    counter++;

                    // We do this b/c make_tmpname might be overridden
                    IRubyObject tmpname = callMethod(runtime.getCurrentContext(),
                                                     "make_tmpname", new IRubyObject[] {basename, runtime.newFixnum(counter)});
                    tmp = JRubyFile.create(getRuntime().getCurrentDirectory(),
                                           new File(dir.convertToString().toString(), tmpname.convertToString().toString()).getPath());
                    if (tmp.createNewFile()) {
                        tmpFile = tmp;
                        path = tmp.getPath();
View Full Code Here

    @JRubyMethod(name = "precs")
    public IRubyObject precs() {
        final Ruby runtime = getRuntime();
        final IRubyObject[] array = new IRubyObject[2];

        array[0] = runtime.newFixnum(getSignificantDigits().length());

        int len = getAllDigits().length();
        int pow = len / 4;
        array[1] = runtime.newFixnum((pow + 1) * 4);

 
View Full Code Here

        array[0] = runtime.newFixnum(getSignificantDigits().length());

        int len = getAllDigits().length();
        int pow = len / 4;
        array[1] = runtime.newFixnum((pow + 1) * 4);

        return RubyArray.newArrayNoCopy(runtime, array);
    }
   
    @Deprecated
View Full Code Here

        // sign
        final RubyFixnum sign;
        if (isNaN) {
            sign = RubyFixnum.zero(runtime);
        } else if (isInfinity()) {
            sign = runtime.newFixnum(infinitySign);
        } else if (isZero()){
            sign = runtime.newFixnum(zeroSign);
        } else {
            sign = runtime.newFixnum(value.signum());
        }
View Full Code Here

        if (isNaN) {
            sign = RubyFixnum.zero(runtime);
        } else if (isInfinity()) {
            sign = runtime.newFixnum(infinitySign);
        } else if (isZero()){
            sign = runtime.newFixnum(zeroSign);
        } else {
            sign = runtime.newFixnum(value.signum());
        }
        array[0] = sign;
View Full Code Here

        } else if (isInfinity()) {
            sign = runtime.newFixnum(infinitySign);
        } else if (isZero()){
            sign = runtime.newFixnum(zeroSign);
        } else {
            sign = runtime.newFixnum(value.signum());
        }
        array[0] = sign;

        // significant digits and exponent
        final RubyString digits;
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.