Package org.jruby.runtime.builtin
Interface IRubyObject
- All Known Subinterfaces:
JavaProxyMethod
- All Known Implementing Classes:
AbstractInvoker,AbstractMemory,AbstractRubyMethod,Addrinfo,ArrayJavaProxy,ArrayJavaProxyCreator,AutoPointer,Buffer,CallbackInfo,ConcreteJavaProxy,ConditionVariable,DynamicLibrary,DynamicLibrary.Symbol,Enums,FileDescriptorIO,Function,Ifaddr,IncludedModule,IncludedModuleWrapper,InterfaceJavaProxy,JavaArray,JavaClass,JavaObject,JavaPackage,JavaPackage.BlankSlateWrapper,JavaProxy,JavaProxyClass,JavaProxyClass.ProxyMethodImpl,JavaProxyConstructor,JavaProxyReflectionObject,JFFIInvoker,JRubyExecutionContextLocal,JRubyFiberLocal,JRubyObjectInputStream,JRubyThreadLocal,JZlibDeflate,JZlibInflate,JZlibRubyGzipReader,JZlibRubyGzipWriter,MapJavaProxy,MapJavaProxy.RubyHashMap,MappedType,MemoryObject,MemoryPointer,MetaClass,Monitor,Mutex,NativeCallbackPointer,NativeException,Option,Pointer,PrependedModule,Queue,RubyArgsFile,RubyArgumentError,RubyArithmeticSequence,RubyArray,RubyArrayOneObject,RubyArraySpecialized,RubyArrayTwoObject,RubyBasicObject,RubyBasicSocket,RubyBigDecimal,RubyBignum,RubyBinding,RubyBoolean,RubyBoolean.False,RubyBoolean.True,RubyChain,RubyClass,RubyClassPathVariable,RubyComplex,RubyConcurrencyError,RubyContinuation,RubyConverter,RubyDate,RubyDateTime,RubyDigest.DigestBase,RubyDigest.DigestClass,RubyDir,RubyDomainError,RubyEncoding,RubyEncodingError,RubyEncodingError.RubyCompatibilityError,RubyEncodingError.RubyConverterNotFoundError,RubyEncodingError.RubyInvalidByteSequenceError,RubyEncodingError.RubyUndefinedConversionError,RubyEnumerator,RubyEnumerator.FeedValue,RubyEOFError,RubyException,RubyFatal,RubyFiberError,RubyFile,RubyFileStat,RubyFixnum,RubyFloat,RubyFloatDomainError,RubyFrozenError,RubyGenerator,RubyGlobal.CaseInsensitiveStringOnlyRubyHash,RubyGlobal.ReadOnlySystemPropertiesHash,RubyGlobal.StringOnlyRubyHash,RubyGzipFile,RubyHash,RubyIndexError,RubyInteger,RubyInterrupt,RubyInterruptedRegexpError,RubyIO,RubyIOError,RubyIPSocket,RubyKeyError,RubyLoadError,RubyLocalJumpError,RubyMatchData,RubyMethod,RubyModule,RubyNameError,RubyNameError.RubyNameErrorMessage,RubyNil,RubyNoMemoryError,RubyNoMethodError,RubyNotImplementedError,RubyNumeric,RubyObject,RubyObject.Data,RubyObjectSpace.WeakMap,RubyPathname,RubyProc,RubyProcess.RubyStatus,RubyRandom,RubyRange,RubyRangeError,RubyRational,RubyRegexp,RubyRegexpError,RubyRipper,RubyRuntimeError,RubyScriptError,RubySecurityError,RubyServerSocket,RubySet,RubySet.DivideTSortHash,RubySignalException,RubySocket,RubySortedSet,RubyStandardError,RubyStopIteration,RubyString,RubyStringScanner,RubyStruct,RubySymbol,RubySyntaxError,RubySyslog,RubySystemCallError,RubySystemExit,RubySystemStackError,RubyTCPServer,RubyTCPSocket,RubyThread,RubyThread.Location,RubyThreadError,RubyThreadGroup,RubyTime,RubyTypeError,RubyUDPSocket,RubyUnboundMethod,RubyUncaughtThrowError,RubyUNIXServer,RubyUNIXSocket,RubyYielder,RubyZeroDivisionError,SizedQueue,StringArraySet,StringIO,Struct,StructByValue,StructLayout,StructLayout.ArrayField,StructLayout.ArrayProxy,StructLayout.CharArrayProxy,StructLayout.EnumField,StructLayout.Field,StructLayout.FunctionField,StructLayout.InnerStructField,StructLayout.NumberField,StructLayout.PointerField,StructLayout.StringField,Tempfile,ThreadFiber,TracePoint,Type,Type.Array,Type.Builtin,UndefinedValue,VariadicInvoker,ZStream
public interface IRubyObject
Object is the parent class of all classes in Ruby. Its methods are
therefore available to all objects unless explicitly overridden.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinalizer(IRubyObject finalizer) static IRubyObject[]array(int length) Convert the object into a symbol name if possible.asString()rb_obj_as_stringcallMethod(ThreadContext context, int methodIndex, String name) Deprecated.callMethod(ThreadContext context, int methodIndex, String name, IRubyObject arg) Deprecated.callMethod(ThreadContext context, String name) callMethod(ThreadContext context, String name, IRubyObject arg) callMethod(ThreadContext context, String name, IRubyObject[] args) callMethod(ThreadContext context, String name, IRubyObject[] args, Block block) callSuper(ThreadContext context, IRubyObject[] args, Block block) Deprecated.checkCallMethod(ThreadContext context, String name) checkCallMethod(ThreadContext context, JavaSites.CheckedSites sites) default IRubyObjectDeprecated.Converts this Ruby object to an Array.Converts this Ruby object to a Float (using to_f).Converts this Ruby object to a Hash.Converts this Ruby object to an Integer.default RubyIntegerconvertToInteger(int convertMethodIndex, String convertMethod) Deprecated.convertToInteger(String convertMethod) Converts this Ruby object to an Integer.Converts this Ruby object to a String.voidOur version of Data_Get_Struct.Deprecated.voiddataWrapStruct(Object obj) Our version of Data_Wrap_Struct.dup()RubyMethod dup.booleaneql(IRubyObject other) RubyMethod getJavaClass.Retrieve</>self.class<.RubyMethod getRuntime.Retrieve</>self.singleton_class<.getType()RubyMethod getType.getVariable(int index) intbooleanReturns true if object has any variables, defined as: instance variables class variables constants internal variables, such as those used when marshalling Ranges and Exceptionsid()infectBy(IRubyObject obj) Infect this object using the taint of another object.inspect()RubyMethod inspect.booleanisClass()booleanisFrozen()RubyMethod isFrozen.booleanbooleanisModule()booleanisNil()Check whether this object is nil.booleanbooleanisTaint()RubyMethod isTaint.booleanisTrue()Check whether this object is truthy.booleanRubyMethod isUntrusted.op_eqq(ThreadContext context, IRubyObject other) op_equal(ThreadContext context, IRubyObject other) rbClone()RubyMethod clone.voidbooleanrespondsTo(String string) RubyMethod respondsTo.booleanrespondsToMissing(String string) RubyMethod respondsTo.booleanrespondsToMissing(String string, boolean priv) RubyMethod respondsTo.voidsetFrozen(boolean b) RubyMethod setFrozen.voidsetTaint(boolean taint) RubyMethod setTaint.voidsetUntrusted(boolean b) RubyMethod setUntrusted.voidsetVariable(int index, Object value) voidsyncVariables(List<Variable<Object>> variables) Deprecated.voidsyncVariables(IRubyObject source) Sets object's variables to those in the supplied object, removing/replacing any previously defined variables of the same name.<T> TConvert the object to the specified Java class, if possible.
-
Field Details
-
NULL_ARRAY
-
-
Method Details
-
array
-
callSuper
Deprecated. -
callMethod
-
callMethod
-
callMethod
-
callMethod
-
callMethod
Deprecated. -
callMethod
@Deprecated IRubyObject callMethod(ThreadContext context, int methodIndex, String name, IRubyObject arg) Deprecated. -
checkCallMethod
-
checkCallMethod
-
isNil
boolean isNil()Check whether this object is nil.- Returns:
- true for
nilonly
-
isTrue
boolean isTrue()Check whether this object is truthy.- Returns:
- false for
nilandfalse, true otherwise
-
isTaint
boolean isTaint()RubyMethod isTaint.- Returns:
- boolean
-
setTaint
void setTaint(boolean taint) RubyMethod setTaint.- Parameters:
taint- the taint flag
-
infectBy
Infect this object using the taint of another object.- Parameters:
obj-- Returns:
- infected (self)
-
isFrozen
boolean isFrozen()RubyMethod isFrozen.- Returns:
- boolean
-
setFrozen
void setFrozen(boolean b) RubyMethod setFrozen.- Parameters:
b-
-
isUntrusted
boolean isUntrusted()RubyMethod isUntrusted.- Returns:
- boolean
-
setUntrusted
void setUntrusted(boolean b) RubyMethod setUntrusted.- Parameters:
b-
-
isImmediate
boolean isImmediate()- Returns:
-
isSpecialConst
boolean isSpecialConst()- Returns:
-
getMetaClass
RubyClass getMetaClass()Retrieve</>self.class<.- Returns:
- the Ruby (meta) class
-
getSingletonClass
RubyClass getSingletonClass()Retrieve</>self.singleton_class<.- Returns:
- the Ruby singleton class
-
getType
RubyClass getType()RubyMethod getType.- Returns:
- RubyClass
-
respondsTo
RubyMethod respondsTo.- Parameters:
string-- Returns:
- boolean
-
respondsToMissing
RubyMethod respondsTo.- Parameters:
string-- Returns:
- boolean
-
respondsToMissing
RubyMethod respondsTo.- Parameters:
string-- Returns:
- boolean
-
getRuntime
Ruby getRuntime()RubyMethod getRuntime.- Returns:
- the Ruby runtime this belongs to
-
getJavaClass
Class getJavaClass()RubyMethod getJavaClass.- Returns:
- Class
-
asJavaString
String asJavaString()Convert the object into a symbol name if possible.- Returns:
- String the symbol name
-
asString
RubyString asString()rb_obj_as_string- Returns:
-
convertToArray
RubyArray convertToArray()Converts this Ruby object to an Array.- Returns:
- an array value
-
convertToHash
RubyHash convertToHash()Converts this Ruby object to a Hash.- Returns:
- a hash value
-
convertToFloat
RubyFloat convertToFloat()Converts this Ruby object to a Float (using to_f).- Returns:
- a float value
-
convertToInteger
RubyInteger convertToInteger()Converts this Ruby object to an Integer. Uses the default conversion method (to_int).- Returns:
- an integer value
-
convertToInteger
Converts this Ruby object to an Integer.- Parameters:
convertMethod- method to use e.g. to_i- Returns:
- an integer value
-
convertToString
RubyString convertToString()Converts this Ruby object to a String.- Returns:
- a string value
-
anyToString
IRubyObject anyToString()- Returns:
-
checkStringType
IRubyObject checkStringType()- Returns:
- nil if type check failed
-
checkArrayType
IRubyObject checkArrayType()- Returns:
- nil if type check failed
-
toJava
Convert the object to the specified Java class, if possible.- Parameters:
type- The target type to which the object should be converted.
-
dup
IRubyObject dup()RubyMethod dup.- Returns:
- a dup-ed object
-
inspect
IRubyObject inspect()RubyMethod inspect.- Returns:
- String
-
rbClone
IRubyObject rbClone()RubyMethod clone.- Returns:
- a cloned object
-
isModule
boolean isModule()- Returns:
- true if an object is Ruby Module instance (note that it will return false for Ruby Classes).
If is_a? semantics is required, use
(someObject instanceof RubyModule)instead.
-
isClass
boolean isClass()- Returns:
- true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes).
If is_a? semantics is required, use
(someObject instanceof RubyClass/MetaClass)instead.
-
dataWrapStruct
Our version of Data_Wrap_Struct. This method will just set a private pointer to the object provided. This pointer is transient and will not be accessible from Ruby.- Parameters:
obj- the object to wrap
-
dataGetStruct
Object dataGetStruct()Our version of Data_Get_Struct. Returns a wrapped data value if there is one, otherwise returns null.- Returns:
- the object wrapped.
-
dataGetStructChecked
Deprecated. -
id
IRubyObject id()- Returns:
- the object id
-
op_equal
-
op_eqq
-
eql
-
addFinalizer
-
removeFinalizers
void removeFinalizers() -
hasVariables
boolean hasVariables()Returns true if object has any variables, defined as:- instance variables
- class variables
- constants
- internal variables, such as those used when marshalling Ranges and Exceptions
- Returns:
- true if object has any variables, else false
-
getVariableCount
int getVariableCount()- Returns:
- the count of all variables (ivar/cvar/constant/internal)
-
syncVariables
Deprecated.Sets object's variables to those in the supplied list, removing/replacing any previously defined variables. Applies to all variable types (ivar/cvar/constant/internal).- Parameters:
variables- the variables to be set for object
-
syncVariables
Sets object's variables to those in the supplied object, removing/replacing any previously defined variables of the same name. Applies to all variable types (ivar/cvar/constant/internal).- Parameters:
source- the source object containing the variables to sync
-
getVariableList
- Returns:
- a list of all variables (ivar/cvar/constant/internal)
-
getInstanceVariables
InstanceVariables getInstanceVariables() -
getInternalVariables
InternalVariables getInternalVariables() -
getVariableNameList
- Returns:
- a list of all variable names (ivar/cvar/constant/internal)
-
copySpecialInstanceVariables
-
getVariable
-
setVariable
-
checkStringType19
Deprecated.UsecheckStringType()instead. -
convertToInteger
Deprecated.- Parameters:
convertMethod-convertMethodIndex-- See Also:
-
checkStringType()instead.