private IRubyObject constructResults(Ruby runtime) { return RubyArray.newArrayLight( runtime, readResults == null ? RubyArray.newEmptyArray(runtime) : readResults, writeResults == null ? RubyArray.newEmptyArray(runtime) : writeResults, errorResults == null ? RubyArray.newEmptyArray(runtime) : errorResults); }
@Override public IRubyObject call(ThreadContext context, Block block) { throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, RubyArray.newEmptyArray(context.runtime), "yield called out of block"); } @Override
public static RubyArray createSubarray(IRubyObject[] input, Ruby runtime, int start) { if (start >= input.length) { return RubyArray.newEmptyArray(runtime); } else { return RubyArray.newArrayMayCopy(runtime, input, start); } }
public static RubyArray createSubarray(IRubyObject[] input, Ruby runtime, int start) { if (start >= input.length) { return RubyArray.newEmptyArray(runtime); } else { return RubyArray.newArrayMayCopy(runtime, input, start); } }
@Override public IRubyObject call(ThreadContext context, Block block) { throw context.runtime.newLocalJumpError(RubyLocalJumpError.Reason.NOREASON, RubyArray.newEmptyArray(context.runtime), "yield called out of block"); } @Override
public static RubyArray createSubarray(IRubyObject[] input, Ruby runtime, int start) { if (start >= input.length) { return RubyArray.newEmptyArray(runtime); } else { return RubyArray.newArrayNoCopy(runtime, input, start); } }
public static RubyArray createSubarray(IRubyObject[] input, Ruby runtime, int start, int exclude) { int length = input.length - exclude - start; if (length <= 0) { return RubyArray.newEmptyArray(runtime); } else { return RubyArray.newArrayNoCopy(runtime, input, start, length); } }
public static RubyArray createSubarray(IRubyObject[] input, Ruby runtime, int start, int exclude) { int length = input.length - exclude - start; if (length <= 0) { return RubyArray.newEmptyArray(runtime); } else { return RubyArray.newArrayMayCopy(runtime, input, start, length); } }
@Deprecated // not used public static RubyArray subarrayOrEmpty(RubyArray array, Ruby runtime, int index, int post) { if (index + post < array.getLength()) { return createSubarray(array, index, post); } else { return RubyArray.newEmptyArray(runtime); } }
@Deprecated // not used public static RubyArray subarrayOrEmpty(RubyArray array, Ruby runtime, int index) { if (index < array.getLength()) { return createSubarray(array, index); } else { return RubyArray.newEmptyArray(runtime); } }
@Deprecated // not used public static RubyArray subarrayOrEmpty(RubyArray array, Ruby runtime, int index, int post) { if (index + post < array.getLength()) { return createSubarray(array, index, post); } else { return RubyArray.newEmptyArray(runtime); } }
public static RubyArray newArray(Ruby runtime, List<? extends IRubyObject> list) { if (list.isEmpty()) { return newEmptyArray(runtime); } return isPackedArray(list) ? packedArray(runtime, list) : new RubyArray(runtime, list.toArray(IRubyObject.NULL_ARRAY)); }
public static RubyArray newArray(Ruby runtime, Collection<? extends IRubyObject> collection) { if (collection.isEmpty()) { return newEmptyArray(runtime); } final IRubyObject[] arr = collection.toArray(IRubyObject.NULL_ARRAY); return isPackedArray(collection) ? packedArray(runtime, arr) : new RubyArray(runtime, arr); }
public static RubyArray convertToRubyArray19(Ruby runtime, IRubyObject value, boolean coerce) { if (value == null) { return RubyArray.newEmptyArray(runtime); } if (coerce) return convertToRubyArrayWithCoerce19(runtime, value); // don't attempt to coerce to array, just wrap and return return RubyArray.newArrayLight(runtime, value); }
@Override public void assign(Ruby runtime, ThreadContext context, IRubyObject self, IRubyObject value1, Block block) { parameter1.assign(runtime, context, self, value1, block, false); rest.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), block, true); }
public static RubyArray subarrayOrEmpty(RubyArray array, Ruby runtime, int index) { if (index < array.getLength()) { return createSubarray(array, index); } else { return RubyArray.newEmptyArray(runtime); } }
public static RubyArray subarrayOrEmpty(RubyArray array, Ruby runtime, int index, int post) { if (index + post < array.getLength()) { return createSubarray(array, index, post); } else { return RubyArray.newEmptyArray(runtime); } }
public static RubyArray newArray(Ruby runtime, List<? extends IRubyObject> list) { if (list.isEmpty()) { return newEmptyArray(runtime); } return isPackedArray(list) ? packedArray(runtime, list) : new RubyArray(runtime, list.toArray(IRubyObject.NULL_ARRAY)); }
public static RubyArray viewArgsArray(ThreadContext context, RubyArray rubyArray, int preArgsCount, int postArgsCount) { int n = rubyArray.getLength(); if (preArgsCount + postArgsCount >= n) { return RubyArray.newEmptyArray(context.runtime); } return (RubyArray)rubyArray.subseq(context.runtime.getArray(), preArgsCount, n - preArgsCount - postArgsCount, true); }
@Override public void assign(Ruby runtime, ThreadContext context, IRubyObject self, Block block) { parameter1.assign(runtime, context, self, runtime.getNil(), block, false); rest.assign(runtime, context, self, RubyArray.newEmptyArray(runtime), block, true); }