Package org.jruby
Class RubyEnumerator
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyEnumerator
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IRubyObject>,Iterator<Object>,InstanceVariables,InternalVariables,IRubyObject,CoreObjectType
Implementation of Ruby's Enumerator module.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInternal Enumerator::FeedValue class to be shared between enumerator and its next-er Fiber.static interfaceRubyEnumerator.SizeFn<T extends IRubyObject>"Function" type for java-created enumerators with size.Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate RubyEnumerator.FeedValuestatic final Stringstatic final Stringstatic final Stringprivate Stringmethod to invoke for each operationstatic final Stringprivate IRubyObject[]args to each methodprivate IRubyObjecttarget for each operationstatic final Stringprivate IRubyObjectA value or proc to provide the size of the Enumerator contentsprivate RubyEnumerator.SizeFnFunction object for lazily computing size (used for internally created enumerators)Fields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORFields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUST_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStampFields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateRubyEnumerator(Ruby runtime, RubyClass type) privateRubyEnumerator(Ruby runtime, RubyClass type, IRubyObject object, RubySymbol method, IRubyObject[] args, IRubyObject size, RubyEnumerator.SizeFn sizeFn) privateRubyEnumerator(Ruby runtime, RubyClass type, IRubyObject object, IRubyObject method, IRubyObject[] args) -
Method Summary
Modifier and TypeMethodDescriptionprivate IRubyObject__each__(ThreadContext context, Block block) static IRubyObject__from(ThreadContext context, IRubyObject klass, IRubyObject[] args) static RubyClassdefineEnumerator(Ruby runtime, RubyModule Enumerable) dup()RubyMethod dup.each(ThreadContext context, Block block) Send current block and supplied args to method on target.each(ThreadContext context, IRubyObject[] args, Block block) each_cons(ThreadContext context, IRubyObject arg, Block block) each_cons19(ThreadContext context, IRubyObject arg, Block block) Deprecated.each_entry(ThreadContext context, IRubyObject[] args, Block block) each_slice(ThreadContext context, IRubyObject arg, Block block) each_slice19(ThreadContext context, IRubyObject arg, Block block) Deprecated.each_with_index(ThreadContext context, Block block) each_with_object(ThreadContext context, IRubyObject arg, Block block) static IRubyObjectenumeratorize(Ruby runtime, RubyClass type, IRubyObject object, String method) static IRubyObjectenumeratorize(Ruby runtime, RubyClass type, IRubyObject object, String method, IRubyObject arg) static IRubyObjectenumeratorize(Ruby runtime, RubyClass type, IRubyObject object, String method, IRubyObject[] args) static IRubyObjectenumeratorize(Ruby runtime, IRubyObject object, String method) static IRubyObjectenumeratorize(Ruby runtime, IRubyObject object, String method, IRubyObject arg) static IRubyObjectenumeratorize(Ruby runtime, IRubyObject object, String method, IRubyObject... args) static IRubyObjectenumeratorizeWithSize(ThreadContext context, IRubyObject object, String method, IRubyObject arg, IRubyObject size) static <T extends IRubyObject>
IRubyObjectenumeratorizeWithSize(ThreadContext context, T object, String method, RubyEnumerator.SizeFn<T> sizeFn) static <T extends IRubyObject>
IRubyObjectenumeratorizeWithSize(ThreadContext context, T object, String method, IRubyObject[] args, RubyEnumerator.SizeFn<T> sizeFn) static <T extends IRubyObject>
RubyEnumeratorenumWithSize(ThreadContext context, T object, String method, RubyEnumerator.SizeFn<T> sizeFn) static <T extends IRubyObject>
RubyEnumeratorenumWithSize(ThreadContext context, T object, String method, IRubyObject[] args, RubyEnumerator.SizeFn<T> sizeFn) Transform object into an Enumerator with the given sizeprivate IRubyObjectbooleanhasNext()private IRubyObjectinitialize(Ruby runtime, IRubyObject object, IRubyObject method, IRubyObject[] methodArgs) private IRubyObjectinitialize(Ruby runtime, IRubyObject object, IRubyObject method, IRubyObject[] methodArgs, IRubyObject size, RubyEnumerator.SizeFn sizeFn) initialize(ThreadContext context) initialize(ThreadContext context, Block block) initialize(ThreadContext context, IRubyObject[] args) initialize(ThreadContext context, IRubyObject[] args, Block block) initialize(ThreadContext context, IRubyObject object, Block block) initialize(ThreadContext context, IRubyObject object, IRubyObject method) initialize(ThreadContext context, IRubyObject object, IRubyObject method, Block block) initialize(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg) initialize(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg, Block block) initialize19(ThreadContext context, Block block) Deprecated.initialize19(ThreadContext context, IRubyObject[] args, Block block) Deprecated.initialize19(ThreadContext context, IRubyObject object, IRubyObject method, Block block) Deprecated.initialize19(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg, Block block) Deprecated.initialize20(ThreadContext context, Block block) Deprecated.initialize20(ThreadContext context, IRubyObject[] args, Block block) Deprecated.initialize20(ThreadContext context, IRubyObject object, Block block) Deprecated.initialize20(ThreadContext context, IRubyObject object, IRubyObject method, Block block) Deprecated.initialize20(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg, Block block) Deprecated.private IRubyObjectinspect(ThreadContext context, boolean recurse) inspect19(ThreadContext context) protected static IRubyObjectnewEnumerator(ThreadContext context, IRubyObject arg) protected static IRubyObjectnewEnumerator(ThreadContext context, IRubyObject arg1, IRubyObject arg2) protected static IRubyObjectnewEnumerator(ThreadContext context, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) next()op_plus(ThreadContext context, IRubyObject obj) voidremove()private static JavaSites.FiberSitessites(ThreadContext context) longsize()final IRubyObjectsize(ThreadContext context) private static IRubyObjectsize(ThreadContext context, RubyEnumerator recv, IRubyObject[] args) A size method suitable for lambda method reference implementation ofRubyEnumerator.SizeFn.size(ThreadContext, IRubyObject, IRubyObject[])spliterator(int mod) stream()stream(boolean parallel) with_index(ThreadContext context, Block block) with_index(ThreadContext context, IRubyObject arg, Block block) private IRubyObjectwith_index_common(ThreadContext context, Block block, String rubyMethodName, IRubyObject arg) with_index19(ThreadContext context, Block block) Deprecated.with_index19(ThreadContext context, IRubyObject arg, Block block) Deprecated.with_object(ThreadContext context, IRubyObject arg, Block block) Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, dig1, dig2, eqlInternal, equalInternal, equals, getNativeClassIndex, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toStringMethods inherited from class org.jruby.RubyBasicObject
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, defaultToJava, display, ensureInstanceVariablesSettable, eql, eql_p, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, infectBy, infectBy, initialize_copy, initialize19, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method, method_missing, method_missing19, method19, methods, methods, methods19, methodsImpl, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_equal, op_equal_19, op_match, op_match19, op_not, op_not_equal, op_not_match, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, rbClone, rbInspect, recacheBuiltinMethods, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted, tainted_p, testFrozen, testFrozen, to_a, to_a, to_s, toJava, trust, type, type_deprecated, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
GENERATOR
- See Also:
-
LOOKAHEAD
- See Also:
-
FEEDVALUE
- See Also:
-
OBJECT
- See Also:
-
METHOD
- See Also:
-
ARGS
- See Also:
-
object
target for each operation -
method
method to invoke for each operation -
methodArgs
args to each method -
size
A value or proc to provide the size of the Enumerator contents -
sizeFn
Function object for lazily computing size (used for internally created enumerators) -
feedValue
-
-
Constructor Details
-
RubyEnumerator
-
RubyEnumerator
private RubyEnumerator(Ruby runtime, RubyClass type, IRubyObject object, RubySymbol method, IRubyObject[] args, IRubyObject size, RubyEnumerator.SizeFn sizeFn) -
RubyEnumerator
private RubyEnumerator(Ruby runtime, RubyClass type, IRubyObject object, IRubyObject method, IRubyObject[] args)
-
-
Method Details
-
defineEnumerator
-
enumWithSize
public static <T extends IRubyObject> RubyEnumerator enumWithSize(ThreadContext context, T object, String method, IRubyObject[] args, RubyEnumerator.SizeFn<T> sizeFn) Transform object into an Enumerator with the given size -
enumeratorizeWithSize
public static <T extends IRubyObject> IRubyObject enumeratorizeWithSize(ThreadContext context, T object, String method, IRubyObject[] args, RubyEnumerator.SizeFn<T> sizeFn) -
enumeratorizeWithSize
public static <T extends IRubyObject> IRubyObject enumeratorizeWithSize(ThreadContext context, T object, String method, RubyEnumerator.SizeFn<T> sizeFn) -
enumWithSize
public static <T extends IRubyObject> RubyEnumerator enumWithSize(ThreadContext context, T object, String method, RubyEnumerator.SizeFn<T> sizeFn) -
enumeratorizeWithSize
public static IRubyObject enumeratorizeWithSize(ThreadContext context, IRubyObject object, String method, IRubyObject arg, IRubyObject size) -
enumeratorize
-
enumeratorize
public static IRubyObject enumeratorize(Ruby runtime, IRubyObject object, String method, IRubyObject arg) -
enumeratorize
public static IRubyObject enumeratorize(Ruby runtime, IRubyObject object, String method, IRubyObject... args) -
enumeratorize
public static IRubyObject enumeratorize(Ruby runtime, RubyClass type, IRubyObject object, String method) -
enumeratorize
public static IRubyObject enumeratorize(Ruby runtime, RubyClass type, IRubyObject object, String method, IRubyObject arg) -
enumeratorize
public static IRubyObject enumeratorize(Ruby runtime, RubyClass type, IRubyObject object, String method, IRubyObject[] args) -
__from
-
initialize
- Overrides:
initializein classRubyBasicObject
-
initialize
-
initialize
-
initialize
-
initialize
public IRubyObject initialize(ThreadContext context, IRubyObject object, IRubyObject method, Block block) -
initialize
public IRubyObject initialize(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg, Block block) -
initialize
public IRubyObject initialize(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg) -
initialize
-
initialize
-
initialize19
Deprecated. -
initialize20
Deprecated. -
initialize20
Deprecated. -
initialize20
Deprecated. -
initialize19
@Deprecated public IRubyObject initialize19(ThreadContext context, IRubyObject object, IRubyObject method, Block block) Deprecated. -
initialize19
@Deprecated public IRubyObject initialize19(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg, Block block) Deprecated. -
initialize20
@Deprecated public IRubyObject initialize20(ThreadContext context, IRubyObject object, IRubyObject method, Block block) Deprecated. -
initialize20
@Deprecated public IRubyObject initialize20(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg, Block block) Deprecated. -
initialize19
Deprecated. -
initialize
private IRubyObject initialize(Ruby runtime, IRubyObject object, IRubyObject method, IRubyObject[] methodArgs) -
initialize
private IRubyObject initialize(Ruby runtime, IRubyObject object, IRubyObject method, IRubyObject[] methodArgs, IRubyObject size, RubyEnumerator.SizeFn sizeFn) -
dup
Description copied from interface:IRubyObjectRubyMethod dup.- Specified by:
dupin interfaceIRubyObject- Overrides:
dupin classRubyBasicObject- Returns:
- a dup-ed object
-
each
Send current block and supplied args to method on target. According to MRI Block may not be given and "each" should just ignore it and call on through to underlying method. -
__each__
-
each
-
inspect19
-
inspect
-
newEnumerator
-
newEnumerator
protected static IRubyObject newEnumerator(ThreadContext context, IRubyObject arg1, IRubyObject arg2) -
newEnumerator
protected static IRubyObject newEnumerator(ThreadContext context, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) -
each_with_object
-
with_object
-
each_entry
-
each_slice19
Deprecated. -
each_slice
-
each_cons19
Deprecated. -
each_cons
-
size
-
size
public long size() -
size
A size method suitable for lambda method reference implementation ofRubyEnumerator.SizeFn.size(ThreadContext, IRubyObject, IRubyObject[]) -
with_index_common
private IRubyObject with_index_common(ThreadContext context, Block block, String rubyMethodName, IRubyObject arg) -
each_with_index
-
with_index
-
with_index19
Deprecated. -
with_index
-
with_index19
Deprecated. -
hasNext
public boolean hasNext() -
getGenerator
-
next
-
remove
public void remove() -
stream
-
stream
-
spliterator
-
spliterator
-
sites
-
op_plus
-