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 classprivate static classprivate static classprivate static classprivate static classstatic classstatic classNested 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 static final Stringstatic final Stringstatic final Stringprivate static final Stringprivate static final byte[]private static final byte[]static final Stringprivate final IRubyObject[]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
ConstructorsModifierConstructorDescriptionprivateRubyStruct(Ruby runtime, RubyClass rubyClass) Constructor for RubyStruct. -
Method Summary
Modifier and TypeMethodDescriptionprivate RubyArrayprivate static RubyArray__member__(RubyClass clazz) (package private) final IRubyObjectaref(int idx) aref(IRubyObject key) private IRubyObjectarefImpl(IRubyObject key, boolean nilOnNoMember) private IRubyObjectaset(int idx, IRubyObject value) aset(IRubyObject key, IRubyObject value) private voidcheckSize(int length) private RubyClassclassOf()voidLots of MRI objects keep their state in non-lookupable ivars (e:g.static RubyClasscreateStructClass(Ruby runtime) 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 IRubyObjectget(int index) private IRubyObjectprivate static IRubyObjectgetInternalVariable(RubyClass type, String internedName) This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.hash(ThreadContext context) 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) rb_obj_init_copy 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) private RubyStringinspectStruct(ThreadContext context, boolean recur) inspect_structstatic voidmarshalTo(RubyStruct struct, MarshalStream output) members()(package private) static RubyArraystatic RubyArraymembers(IRubyObject recv, Block block) Deprecated.final RubyArrayDeprecated.static RubyArraymembers19(IRubyObject recv, Block block) Deprecated.private voidmodify()static RubyClassnewInstance(IRubyObject recv, IRubyObject[] args, Block block) Create new Struct class.static RubyStructnewStruct(IRubyObject recv, Block block) static RubyStructnewStruct(IRubyObject recv, IRubyObject[] args, Block block) Create new Structure.static RubyStructnewStruct(IRubyObject recv, IRubyObject arg0, Block block) static RubyStructnewStruct(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, Block block) static RubyStructnewStruct(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) private RaiseExceptionop_equal(ThreadContext context, IRubyObject other) rb_obj_equal Will by default use identity equality to compare objects.private static RubyClasspathToClass(Ruby runtime, String path) select(ThreadContext context, Block block) set(IRubyObject value, int index) private IRubyObjectsetByName(String name, IRubyObject value) private voidsetupStructValuesFromHash(ThreadContext context, RubyHash kwArgs) size()private static IRubyObjectsize(ThreadContext context, RubyStruct recv, IRubyObject[] args) A size method suitable for lambda method reference implementation ofRubyEnumerator.SizeFn.size(ThreadContext, IRubyObject, IRubyObject[])to_a()Deprecated.to_a(ThreadContext context) rb_any_to_a call-seq: obj.to_a -> anArray Returns an array representation of obj.to_h(ThreadContext context) Deprecated.to_h(ThreadContext context, Block block) static RubyStructunmarshalFrom(UnmarshalStream input) values_at(IRubyObject[] args) 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, 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, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, defaultToJava, display, dup, 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, 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_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_s, toJava, trust, type, type_deprecated, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
-
Field Details
-
NO_MEMBER_IN_STRUCT
- See Also:
-
IDENTIFIER_NEEDS_TO_BE_CONSTANT
- See Also:
-
UNINITIALIZED_CONSTANT
- See Also:
-
KEYWORD_INIT_VAR
- See Also:
-
SIZE_VAR
- See Also:
-
MEMBER_VAR
- See Also:
-
values
-
STRUCT_BEG
private static final byte[] STRUCT_BEG -
STRUCT_END
private static final byte[] STRUCT_END
-
-
Constructor Details
-
RubyStruct
Constructor for RubyStruct.- Parameters:
runtime-rubyClass-
-
-
Method Details
-
createStructClass
-
getNativeClassIndex
Description copied from class:RubyObjectThis 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:
getNativeClassIndexin interfaceCoreObjectType- Overrides:
getNativeClassIndexin classRubyObject- See Also:
-
getInternalVariable
-
classOf
-
modify
private void modify() -
hash
-
setByName
-
getByName
-
newInstance
Create new Struct class. MRI: rb_struct_s_def / make_struct -
newStruct
Create new Structure. MRI: struct_alloc -
newStruct
-
newStruct
-
newStruct
public static RubyStruct newStruct(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, Block block) -
newStruct
public static RubyStruct newStruct(IRubyObject recv, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) -
checkSize
private void checkSize(int length) -
initialize
-
setupStructValuesFromHash
-
initialize
- Overrides:
initializein 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
-
members
Deprecated. -
__member__
-
__member__
-
members
-
members19
Deprecated. -
select
-
size
A size method suitable for lambda method reference implementation ofRubyEnumerator.SizeFn.size(ThreadContext, IRubyObject, IRubyObject[]) -
set
-
notStructMemberError
-
get
-
copySpecialInstanceVariables
Description copied from class:RubyBasicObjectLots 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:
copySpecialInstanceVariablesin interfaceIRubyObject- Overrides:
copySpecialInstanceVariablesin classRubyBasicObject
-
op_equal
Description copied from class:RubyBasicObjectrb_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_equalin interfaceIRubyObject- Overrides:
op_equalin classRubyBasicObject
-
eql_p
-
inspectStruct
inspect_struct -
inspect
-
to_a
Description copied from class:RubyBasicObjectrb_any_to_a call-seq: obj.to_a -> anArray Returns an array representation of obj. For objects of classObjectand others that don't explicitly override the method, the return value is an array containingself. However, this latter behavior will soon be obsolete. self.to_a #=> -:1: warning: default `to_a' will be obsolete "hello".to_a #=> ["hello"] Time.new.to_a #=> [39, 54, 8, 9, 4, 2003, 3, 99, true, "CDT"] The default to_a method is deprecated.- Overrides:
to_ain classRubyBasicObject
-
to_h
Deprecated. -
to_h
-
size
-
eachInternal
-
each
-
each_pairInternal
-
each_pair
-
aref
-
arefImpl
-
aref
-
aset
-
aset
-
values_at
-
dig
-
dig
-
dig
-
dig
-
marshalTo
- Throws:
IOException
-
unmarshalFrom
- Throws:
IOException
-
pathToClass
-
initialize_copy
Description copied from class:RubyBasicObjectrb_obj_init_copy 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_copyin classRubyBasicObject
-
members19
Deprecated. -
to_a
Deprecated.- Overrides:
to_ain classRubyBasicObject
-