Package org.jruby
Class RubyRange
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyRange
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,InstanceVariables
,InternalVariables
,IRubyObject
,CoreObjectType
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
Fields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
Fields 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, 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, varTableStamp
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionbegin
(ThreadContext context) void
Lots of MRI objects keep their state in non-lookupable ivars (e:g.count
(ThreadContext context, Block block) cover_p
(ThreadContext context, IRubyObject obj) static RubyClass
createRangeClass
(ThreadContext context, RubyClass Object, RubyModule Enumerable) each
(ThreadContext context, Block block) end
(ThreadContext context) eql_p
(ThreadContext context, IRubyObject other) eqq_p
(ThreadContext context, IRubyObject obj) Deprecated.exclude_end_p
(ThreadContext context) first
(ThreadContext context) first
(ThreadContext context, IRubyObject arg) hash
(ThreadContext context) Will return the hash code of this object.include_p
(ThreadContext context, IRubyObject obj) initialize
(ThreadContext context, IRubyObject[] args, Block unusedBlock) initialize_copy
(ThreadContext context, IRubyObject original) Initializes this object as a copy of the original, that is the parameter to this object.inspect
(ThreadContext context) Returns a string containing a human-readable representation of obj.final boolean
static boolean
isRangeLike
(ThreadContext context, IRubyObject obj, RespondToCallSite respond_to_begin, RespondToCallSite respond_to_end) Return true if the given object responds to "begin" and "end" methods.static boolean
isRangeLike
(ThreadContext context, IRubyObject obj, JavaSites.CheckedSites begin_checked, JavaSites.CheckedSites end_checked, JavaSites.CheckedSites exclude_end_checked) Return true if the given object responds to "begin", "end" and "exclude_end?" methods.last
(ThreadContext context) last
(ThreadContext context, IRubyObject arg) max
(ThreadContext context, Block block) max
(ThreadContext context, IRubyObject arg, Block block) min
(ThreadContext context, Block block) min
(ThreadContext context, IRubyObject arg, Block block) minmax
(ThreadContext context, Block block) static RubyRange
newBeginlessRange
(ThreadContext context, long end, boolean isExclusive) static RubyRange
newEndlessRange
(ThreadContext context, long begin, boolean isExclusive) static RubyRange
newExclusiveRange
(ThreadContext context, long begin, long end) static RubyRange
newExclusiveRange
(ThreadContext context, IRubyObject begin, IRubyObject end) static RubyRange
newInclusiveRange
(ThreadContext context, long begin, long end) static RubyRange
newInclusiveRange
(ThreadContext context, IRubyObject begin, IRubyObject end) static RubyRange
newRange
(ThreadContext context, long begin, long end, boolean isExclusive) static RubyRange
newRange
(ThreadContext context, IRubyObject begin, IRubyObject end, boolean isExclusive) op_equal
(ThreadContext context, IRubyObject other) rb_obj_equal Will by default use identity equality to compare objects.op_mod
(ThreadContext context, IRubyObject step) static IRubyObject
rangeBeginLength
(ThreadContext context, IRubyObject range, int len, int[] begLen, int err) static RubyRange
rangeFromRangeLike
(ThreadContext context, IRubyObject rangeLike, CallSite beginSite, CallSite endSite, CallSite excludeEndSite) Given a range-line object that response to "begin", "end", construct a proper range by calling those methods and "exclude_end?" with the given call sites.static RubyRange.RangeLike
rangeValues
(ThreadContext context, IRubyObject range) reverse_each
(ThreadContext context, Block block) size
(ThreadContext context) step
(ThreadContext context, Block block) step
(ThreadContext context, IRubyObject step, Block block) to_a
(ThreadContext context, Block block) to_s
(ThreadContext context) Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, equals, finishObjectClass, getNativeClassIndex, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toString
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, cloneSetup, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dup, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, freeze, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, initialize, initialize_copy, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_match, op_not, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbClone, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, singletonClass, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, to_s, toJava, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, dup, marshalLiveVariables
-
Method Details
-
createRangeClass
public static RubyClass createRangeClass(ThreadContext context, RubyClass Object, RubyModule Enumerable) -
newRange
public static RubyRange newRange(ThreadContext context, IRubyObject begin, IRubyObject end, boolean isExclusive) -
newBeginlessRange
-
newEndlessRange
-
newRange
-
newInclusiveRange
public static RubyRange newInclusiveRange(ThreadContext context, IRubyObject begin, IRubyObject end) -
newInclusiveRange
-
newExclusiveRange
public static RubyRange newExclusiveRange(ThreadContext context, IRubyObject begin, IRubyObject end) -
newExclusiveRange
-
copySpecialInstanceVariables
Description copied from class:RubyBasicObject
Lots of MRI objects keep their state in non-lookupable ivars (e:g. Range, Struct, etc). This method is responsible for dupping our java field equivalents- Specified by:
copySpecialInstanceVariables
in interfaceIRubyObject
- Overrides:
copySpecialInstanceVariables
in classRubyBasicObject
-
initialize
-
initialize_copy
Description copied from class:RubyBasicObject
Initializes this object as a copy of the original, that is the parameter to this object. Will make sure that the argument actually has the same real class as this object. It shouldn't be possible to initialize an object with something totally different.- Overrides:
initialize_copy
in classRubyBasicObject
- Parameters:
context
- the thread contextoriginal
- the original- Returns:
- a copy unless the same thing
-
hash
Description copied from class:RubyBasicObject
Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.- Overrides:
hash
in classRubyBasicObject
- Parameters:
context
- the current thread context- Returns:
- the hash value
-
inspect
Description copied from class:RubyBasicObject
Returns a string containing a human-readable representation of obj. If not overridden, uses theto_s
method to generate the string. [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"- Specified by:
inspect
in interfaceIRubyObject
- Overrides:
inspect
in classRubyBasicObject
-
to_s
- Overrides:
to_s
in classRubyBasicObject
-
exclude_end_p
-
exclude_end_p
Deprecated. -
eql_p
- Overrides:
eql_p
in classRubyBasicObject
-
op_equal
Description copied from class:RubyBasicObject
rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems- Specified by:
op_equal
in interfaceIRubyObject
- Overrides:
op_equal
in classRubyBasicObject
-
to_a
-
each
-
reverse_each
-
step
-
step
-
op_mod
-
include_p
-
eqq_p
-
cover_p
-
min
-
min
-
max
-
max
-
first
-
begin
-
first
-
count
-
minmax
-
last
-
end
-
last
-
size
-
isExcludeEnd
public final boolean isExcludeEnd() -
rangeFromRangeLike
public static RubyRange rangeFromRangeLike(ThreadContext context, IRubyObject rangeLike, CallSite beginSite, CallSite endSite, CallSite excludeEndSite) Given a range-line object that response to "begin", "end", construct a proper range by calling those methods and "exclude_end?" with the given call sites.- Parameters:
context
- current contextrangeLike
- range-like objectbeginSite
- "begin" call siteendSite
- "end" call siteexcludeEndSite
- "exclude_end?" call site- Returns:
- a proper Range based on the results of calling those methods
-
isRangeLike
public static boolean isRangeLike(ThreadContext context, IRubyObject obj, RespondToCallSite respond_to_begin, RespondToCallSite respond_to_end) Return true if the given object responds to "begin" and "end" methods.- Parameters:
context
- current contextobj
- possibly range-like objectrespond_to_begin
- respond_to? site for beginrespond_to_end
- respond_to? site for end- Returns:
-
isRangeLike
public static boolean isRangeLike(ThreadContext context, IRubyObject obj, JavaSites.CheckedSites begin_checked, JavaSites.CheckedSites end_checked, JavaSites.CheckedSites exclude_end_checked) Return true if the given object responds to "begin", "end" and "exclude_end?" methods.- Parameters:
context
- current contextobj
- possibly range-like objectbegin_checked
- checked site for beginend_checked
- checked site for endexclude_end_checked
- checked site for exclude_end?- Returns:
-
rangeBeginLength
public static IRubyObject rangeBeginLength(ThreadContext context, IRubyObject range, int len, int[] begLen, int err) -
rangeValues
-