Package org.jruby

Examples of org.jruby.RubyArray.entry()


    // arrays are handled recursively:
    if (rubyObject instanceof RubyArray) {
      RubyArray rubyArray = (RubyArray) rubyObject;
      int length = rubyArray.getLength();
      for (int i = 0; i < length; i++) {
        fetchRowsFromScriptOutput(rubyArray.entry(i), inRow, r, rowList, forFields, forRow);
      }
      return;
    }

    // at this point the returned object is not nil, not a hash and not an array, let's ignore the output but warn in the log
View Full Code Here


            fillJavaObject = converter.convert(context, rubyArray);
        }
       
        int i = 0;
        for (; i < rubyLength && i < javaLength; i++) {
            javaArrayJavaObj.setWithExceptionHandling(i, converter.convert(context, array.entry(i)));
        }
       
        if (i < javaLength && fillJavaObject != null) {
            javaArrayJavaObj.fillWithExceptionHandling(i, javaLength, fillJavaObject);
        }
View Full Code Here

    @Override
    public Label interpret(InterpreterContext interp, IRubyObject self) {
        // ENEBO: Can I assume since IR figured this is an internal array it will be RubyArray like this?
        RubyArray array = (RubyArray) getArg().retrieve(interp);

        getResult().store(interp, array.entry(index));
        return null;
    }
}
View Full Code Here

            RubyModule pathHelper = runtime.getClassFromPath("JRuby::PathHelper");
            RubyArray parts = (RubyArray) RuntimeHelpers.invoke(
                    context, pathHelper, "smart_split_command", rawArgs);
            args = new String[parts.getLength()];
            for (int i = 0; i < parts.getLength(); i++) {
                args[i] = parts.entry(i).toString();
            }
        } else {
            args = new String[rawArgs.length];
            for (int i = 0; i < rawArgs.length; i++) {
                args[i] = rawArgs[i].toString();
View Full Code Here

        final RubyArray arr = (RubyArray) arrParam;
        final int count = arr.getLength();

        long off = getOffset(offset);
        for (int i = 0; i < count; ++i) {
            putPointer(context, off + (i * POINTER_SIZE), arr.entry(i));
        }
        return this;
    }
   
    @JRubyMethod(name = { "read_array_of_pointer" }, required = 1)
View Full Code Here

                }
               
                for (int i = 0; i < count; ++i) {
                    op.put(context, memory,
                            m.offset + (i * arrayType.getComponentType().getNativeSize()),
                            ary.entry(i));
                }
            } else {
                throw context.getRuntime().newNotImplementedError("cannot set array field");
            }
        }
View Full Code Here

            convention = args[3].asJavaString();
        }

        Type[] parameterTypes = new Type[paramTypes.size()];
        for (int i = 0; i < parameterTypes.length; ++i) {
            IRubyObject type = paramTypes.entry(i);
            if (!(type instanceof Type)) {
                throw context.getRuntime().newArgumentError("Invalid parameter type");
            }
            parameterTypes[i] = (Type) paramTypes.entry(i);
        }
View Full Code Here

        for (int i = 0; i < parameterTypes.length; ++i) {
            IRubyObject type = paramTypes.entry(i);
            if (!(type instanceof Type)) {
                throw context.getRuntime().newArgumentError("Invalid parameter type");
            }
            parameterTypes[i] = (Type) paramTypes.entry(i);
        }
        DirectMemoryIO fptr = (DirectMemoryIO) ptr.getMemoryIO();
        return new JFFIInvoker(context.getRuntime(), (RubyClass) recv, fptr,
                (Type) returnType, parameterTypes,
                "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
View Full Code Here

        }

        RubyArray paramTypes = (RubyArray) args[1];
        Type[] parameterTypes = new Type[paramTypes.size()];
        for (int i = 0; i < parameterTypes.length; ++i) {
            parameterTypes[i] = FFIUtil.resolveType(context, paramTypes.entry(i));
        }

        if (args.length > 2 && args[2] instanceof Pointer) {
            fptr = new CodeMemoryIO(context.getRuntime(), (Pointer) args[2]);
            optionsIndex = 3;
View Full Code Here

            fillJavaObject = rubyArray.toJava(targetType);
        }
       
        int i = 0;
        for (; i < rubyLength && i < javaLength; i++) {
            javaArrayJavaObj.setWithExceptionHandling(i, array.entry(i).toJava(targetType));
        }
       
        if (i < javaLength && fillJavaObject != null) {
            javaArrayJavaObj.fillWithExceptionHandling(i, javaLength, fillJavaObject);
        }
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.