Package org.jruby
Class RubyStruct
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyStruct
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,InstanceVariables
,InternalVariables
,IRubyObject
,CoreObjectType
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaref
(IRubyObject key) Deprecated.aref
(ThreadContext context, IRubyObject key) aset
(IRubyObject key, IRubyObject value) Deprecated.aset
(ThreadContext context, IRubyObject key, IRubyObject value) compare
(ThreadContext context, CallSite site, IRubyObject other) void
Lots of MRI objects keep their state in non-lookupable ivars (e:g.static RubyClass
createStructClass
(ThreadContext context, RubyClass Object, RubyModule Enumerable) deconstruct_keys
(ThreadContext context, IRubyObject keysArg) dig
(ThreadContext context, IRubyObject arg0) dig
(ThreadContext context, IRubyObject[] args) dig
(ThreadContext context, IRubyObject arg0, IRubyObject arg1) dig
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) each
(ThreadContext context, Block block) each_pair
(ThreadContext context, Block block) each_pairInternal
(ThreadContext context, Block block) eachInternal
(ThreadContext context, Block block) eql_p
(ThreadContext context, IRubyObject other) final IRubyObject
get
(int index) This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.hash
(ThreadContext context) Will return the hash code of this object.initialize
(ThreadContext context) initialize
(ThreadContext context, IRubyObject arg0) initialize
(ThreadContext context, IRubyObject[] args) initialize
(ThreadContext context, IRubyObject arg0, IRubyObject arg1) initialize
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) initialize_copy
(ThreadContext context, IRubyObject arg) Initializes this object as a copy of the original, that is the parameter to this object.initializeInternal
(ThreadContext context, int provided, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) inspect
(ThreadContext context) Returns a string containing a human-readable representation of obj.static void
marshalTo
(RubyStruct struct, MarshalStream output) Deprecated, for removal: This API element is subject to removal in a future version.static void
marshalTo
(ThreadContext context, RubyOutputStream out, RubyStruct struct, MarshalDumper output) members()
Deprecated.static RubyArray
members
(IRubyObject recv, Block block) Deprecated.members
(ThreadContext context) static RubyClass
newInstance
(IRubyObject recv, IRubyObject[] args, Block block) Deprecated.static RubyClass
newInstance
(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) Create new Struct class.static RubyStruct
newStruct
(IRubyObject recv, Block block) Deprecated.static RubyStruct
newStruct
(IRubyObject recv, IRubyObject[] args, Block block) Deprecated.static RubyStruct
newStruct
(IRubyObject recv, IRubyObject arg0, Block block) Deprecated.static RubyStruct
newStruct
(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, Block block) Deprecated.static RubyStruct
newStruct
(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) Deprecated.op_equal
(ThreadContext context, IRubyObject other) rb_obj_equal Will by default use identity equality to compare objects.select
(ThreadContext context, Block block) set
(IRubyObject value, int index) Deprecated.size()
Deprecated.size
(ThreadContext context) to_a()
Deprecated.to_a
(ThreadContext context) to_h
(ThreadContext context) Deprecated.to_h
(ThreadContext context, Block block) static IRubyObject
unmarshalFrom
(UnmarshalStream input) Deprecated, for removal: This API element is subject to removal in a future version.static IRubyObject
unmarshalFrom
(ThreadContext context, RubyInputStream in, MarshalLoader input) values_at
(IRubyObject[] args) Deprecated.values_at
(ThreadContext context, IRubyObject[] args) 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, 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_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_s, 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
-
Field Details
-
NO_MEMBER_IN_STRUCT
- See Also:
-
IDENTIFIER_NEEDS_TO_BE_CONSTANT
- See Also:
-
UNINITIALIZED_CONSTANT
- See Also:
-
MEMBER_VAR
- See Also:
-
-
Constructor Details
-
RubyStruct
-
-
Method Details
-
createStructClass
public static RubyClass createStructClass(ThreadContext context, RubyClass Object, RubyModule Enumerable) -
getNativeClassIndex
Description copied from class:RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndex
in interfaceCoreObjectType
- Overrides:
getNativeClassIndex
in classRubyObject
- Returns:
- the ClassIndex of the native type this object was constructed from
- See Also:
-
deconstruct_keys
-
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
-
newInstance
Deprecated. -
newInstance
public static RubyClass newInstance(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) Create new Struct class. MRI: rb_struct_s_def / make_struct -
newStruct
@Deprecated(since="10.0") public static RubyStruct newStruct(IRubyObject recv, IRubyObject[] args, Block block) Deprecated.Create new Structure. MRI: struct_alloc -
newStruct
Deprecated.UseCreate.newStruct(ThreadContext, RubyClass, Block)
instead.- Parameters:
recv
-block
-- Returns:
-
newStruct
@Deprecated(since="10.0") public static RubyStruct newStruct(IRubyObject recv, IRubyObject arg0, Block block) Deprecated.- Parameters:
recv
-arg0
-block
-- Returns:
-
newStruct
@Deprecated(since="10.0") public static RubyStruct newStruct(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, Block block) Deprecated.- Parameters:
recv
-arg0
-arg1
-block
-- Returns:
-
newStruct
@Deprecated(since="10.0") public static RubyStruct newStruct(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) Deprecated.- Parameters:
recv
-arg0
-arg1
-arg2
-block
-- Returns:
-
initialize
-
initialize
- Overrides:
initialize
in classRubyBasicObject
-
initialize
-
initialize
-
initialize
public IRubyObject initialize(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
initializeInternal
public IRubyObject initializeInternal(ThreadContext context, int provided, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
members
Deprecated. -
members
Deprecated. -
members
-
select
-
set
Deprecated. -
get
-
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
-
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
-
eql_p
- Overrides:
eql_p
in classRubyBasicObject
-
compare
-
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_a
- Overrides:
to_a
in classRubyBasicObject
-
to_h
Deprecated. -
to_h
-
size
-
size
Deprecated. -
eachInternal
-
each
-
each_pairInternal
-
each_pair
-
aref
Deprecated. -
aref
-
aset
Deprecated. -
aset
-
values_at
Deprecated. -
values_at
-
dig
-
dig
-
dig
-
dig
-
marshalTo
@Deprecated(since="10.0", forRemoval=true) public static void marshalTo(RubyStruct struct, MarshalStream output) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
marshalTo
public static void marshalTo(ThreadContext context, RubyOutputStream out, RubyStruct struct, MarshalDumper output) -
unmarshalFrom
@Deprecated(since="10.0", forRemoval=true) public static IRubyObject unmarshalFrom(UnmarshalStream input) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
unmarshalFrom
public static IRubyObject unmarshalFrom(ThreadContext context, RubyInputStream in, MarshalLoader input) -
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 contextarg
- the original- Returns:
- a copy unless the same thing
-
to_a
Deprecated.- Overrides:
to_a
in classRubyBasicObject
-
Create.newStruct(ThreadContext, RubyClass, Block)
instead.