Package org.jruby

Examples of org.jruby.RubyInteger


    }
   
    @JRubyMethod(backtrace = true)
    public IRubyObject at(ThreadContext context, IRubyObject indexObj) {
        RubyFixnum lengthF = getJavaArray().length();
        RubyInteger indexI = indexObj.convertToInteger();
       
        if (indexI.getLongValue() < 0) {
            indexI = RubyFixnum.newFixnum(context.getRuntime(), indexI.getLongValue() + lengthF.getLongValue());
        }
        long index = indexI.getLongValue();
       
        if (index >= 0 && index < lengthF.getLongValue()) {
            return JavaUtil.java_to_ruby(context.getRuntime(), getJavaArray().aref(indexI));
        } else {
            return context.getRuntime().getNil();
View Full Code Here


            ByteList num = absSubSequence(memo, p);
            // note: this is actually a shared string, but since it is temporary and
            //       read-only, it doesn't really matter
            RubyString expr = RubyString.newStringLight(getRuntime(), num);
            RubyInteger number = RubyNumeric.str2inum(getRuntime(), expr, 10, true);
            return new ParserResult(number, p + 1);
        }
View Full Code Here

            int new_p = parseIntegerInternal(p, pe);
            if (new_p == -1) {
                res.update(null, p);
                return;
            }
            RubyInteger number = createInteger(p, new_p);
            res.update(number, new_p + 1);
            return;
        }
View Full Code Here


       public static String convertToInteger(Object rubyObject) throws AxisFault {
           try {
               if(rubyObject instanceof RubyInteger){
               RubyInteger intObject = (RubyInteger) rubyObject;
               return intObject.toString();
               }
               return Integer.toString(RubyInteger.num2int((IRubyObject)rubyObject)) ;
              // return rubyObject.toString();
              
           } catch (Exception e) {
View Full Code Here

    }
   
    @JRubyMethod(backtrace = true)
    public IRubyObject at(ThreadContext context, IRubyObject indexObj) {
        RubyFixnum lengthF = getJavaArray().length();
        RubyInteger indexI = indexObj.convertToInteger();
       
        if (indexI.getLongValue() < 0) {
            indexI = RubyFixnum.newFixnum(context.getRuntime(), indexI.getLongValue() + lengthF.getLongValue());
        }
        long index = indexI.getLongValue();
       
        if (index >= 0 && index < lengthF.getLongValue()) {
            return getJavaArray().arefDirect((int)indexI.getLongValue());
        } else {
            return context.getRuntime().getNil();
        }
    }
View Full Code Here

            int new_p = parseIntegerInternal(p, pe);
            if (new_p == -1) {
                res.update(null, p);
                return;
            }
            RubyInteger number = createInteger(p, new_p);
            res.update(number, new_p + 1);
            return;
        }
View Full Code Here

            int new_p = parseIntegerInternal(p, pe);
            if (new_p == -1) {
                res.update(null, p);
                return;
            }
            RubyInteger number = createInteger(p, new_p);
            res.update(number, new_p + 1);
            return;
        }
View Full Code Here

            int new_p = parseIntegerInternal(p, pe);
            if (new_p == -1) {
                res.update(null, p);
                return;
            }
            RubyInteger number = createInteger(p, new_p);
            res.update(number, new_p + 1);
            return;
        }
View Full Code Here

        return nativeType;
    }

    @JRubyMethod(name = "to_native")
    public final IRubyObject to_native(ThreadContext context, IRubyObject name, IRubyObject ctx) {
        RubyInteger value;

        if (name instanceof RubyFixnum) {
            return name;

        } else if (name instanceof RubySymbol && (value = symbolToValue.get(name)) != null) {
View Full Code Here

TOP

Related Classes of org.jruby.RubyInteger

Copyright © 2018 www.massapicom. 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.