Package org.jruby

Examples of org.jruby.RubyArray.store()


            ByteList bl = self.getByteList();
            byte[] uBytes = bl.unsafeBytes();
            RubyArray array = runtime.newArray(bl.length());
            for (int i = bl.begin(), t = bl.begin() + bl.length(); i < t; i++) {
                array.store(i, runtime.newFixnum(uBytes[i] & 0xff));
            }

            result.op_aset(context, runtime.newString("raw"), array);
            return result;
        }
View Full Code Here


        RubyHash covHash = RubyHash.newHash(runtime);
        for (Map.Entry<String, Integer[]> entry : coverage.entrySet()) {
            RubyArray ary = RubyArray.newArray(runtime, entry.getValue().length);
            for (int i = 0; i < entry.getValue().length; i++) {
                Integer integer = entry.getValue()[i];
                ary.store(i, integer == null ? runtime.getNil() : runtime.newFixnum(integer));
                covHash.fastASetCheckString(runtime, RubyString.newString(runtime, entry.getKey()), ary);
            }
        }
       
        return covHash;
View Full Code Here

    private static RubyArray mapToPathnames(ThreadContext context, RubyClass clazz, IRubyObject ary) {
        RubyArray paths = ary.convertToArray();
        for (int i = 0; i < paths.size(); i++) {
            RubyString path = paths.eltOk(i).convertToString();
            paths.store(i, newInstance(context, clazz, path));
        }
        return paths;
    }
}
View Full Code Here

        RubyHash covHash = RubyHash.newHash(runtime);
        for (Map.Entry<String, int[]> entry : coverage.entrySet()) {
            RubyArray ary = RubyArray.newArray(runtime, entry.getValue().length);
            for (int i = 0; i < entry.getValue().length; i++) {
                int integer = entry.getValue()[i];
                ary.store(i, integer == -1 ? context.nil : runtime.newFixnum(integer));
                covHash.fastASetCheckString(runtime, RubyString.newString(runtime, entry.getKey()), ary);
            }
        }
       
        return covHash;
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.