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
,JavaProxy
,JavaProxyClass
,JavaProxyClass.ProxyMethodImpl
,JavaProxyConstructor
,JavaProxyReflectionObject
,JFFIInvoker
,JRubyExecutionContextLocal
,JRubyFiberLocal
,JRubyObjectInputStream
,JRubyThreadLocal
,JZlibDeflate
,JZlibInflate
,JZlibRubyGzipReader
,JZlibRubyGzipWriter
,MapJavaProxy
,MappedType
,MemoryObject
,MemoryPointer
,MetaClass
,Monitor
,Mutex
,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.StringOnlyRubyHash
,RubyGzipFile
,RubyHash
,RubyIndexError
,RubyInteger
,RubyInterrupt
,RubyInterruptedRegexpError
,RubyIO
,RubyIO.RubyIOTimeoutError
,RubyIOBuffer
,RubyIOError
,RubyIPSocket
,RubyKeyError
,RubyLoadError
,RubyLocalJumpError
,RubyMatchData
,RubyMethod
,RubyModule
,RubyNameError
,RubyNameError.RubyNameErrorMessage
,RubyNil
,RubyNoMatchingPatternError
,RubyNoMatchingPatternKeyError
,RubyNoMemoryError
,RubyNoMethodError
,RubyNotImplementedError
,RubyNumeric
,RubyObject
,RubyObject.Data
,RubyObjectSpace.AbstractWeakMap
,RubyObjectSpace.WeakKeyMap
,RubyObjectSpace.WeakMap
,RubyPathname
,RubyProc
,RubyProcess.RubyStatus
,RubyProducer
,RubyRandom
,RubyRandomBase
,RubyRange
,RubyRangeError
,RubyRational
,RubyRegexp
,RubyRegexpError
,RubyRipper
,RubyRuntimeError
,RubyScriptError
,RubySecurityError
,RubyServerSocket
,RubySet
,RubySet.DivideTSortHash
,RubySignalException
,RubySocket
,RubySortedSet
,RubyStandardError
,RubyStopIteration
,RubyString
,RubyString.FString
,RubyStruct
,RubySymbol
,RubySyntaxError
,RubySyslog
,RubySystemCallError
,RubySystemExit
,RubySystemStackError
,RubyTCPServer
,RubyTCPSocket
,RubyThread
,RubyThread.Backtrace
,RubyThread.Location
,RubyThreadError
,RubyThreadGroup
,RubyTime
,RubyTypeError
,RubyUDPSocket
,RubyUnboundMethod
,RubyUncaughtThrowError
,RubyUNIXServer
,RubyUNIXSocket
,RubyYielder
,RubyZeroDivisionError
,SizedQueue
,StringArraySet
,Struct
,StructByValue
,StructLayout
,StructLayout.ArrayField
,StructLayout.ArrayProxy
,StructLayout.CharArrayProxy
,StructLayout.EnumField
,StructLayout.Field
,StructLayout.FunctionField
,StructLayout.InnerStructField
,StructLayout.NumberField
,StructLayout.PointerField
,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 TypeMethodDescriptionvoid
addFinalizer
(IRubyObject finalizer) Deprecated.default IRubyObject
addFinalizer
(ThreadContext context, IRubyObject finalizer) make this object into a string (hopefully)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.is this an array if so return it otherwise nilcheckCallMethod
(ThreadContext context, String name) checkCallMethod
(ThreadContext context, JavaSites.CheckedSites sites) is this a string if so return it otherwise nildefault IRubyObject
Deprecated.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 RubyInteger
convertToInteger
(int convertMethodIndex, String convertMethod) Deprecated.convertToInteger
(String convertMethod) Converts this Ruby object to an Integer.Converts this Ruby object to a String.void
Our version of Data_Get_Struct.Deprecated.void
dataWrapStruct
(Object obj) Our version of Data_Wrap_Struct.dup()
RubyMethod dup.default IRubyObject
dup
(ThreadContext context) RubyMethod dup.boolean
eql
(IRubyObject other) RubyMethod getJavaClass.all marshable valuesRetrieveself.class
.RubyMethod getRuntime.Retrieveself.singleton_class
.getType()
RubyMethod getType.getVariable
(int index) int
how many variables?list of all variableslist of all variable namesboolean
Returns true if object has any variables, defined as: instance variables class variables constants internal variables, such as those used when marshalling Ranges and Exceptionsid()
The id of the objectinfectBy
(IRubyObject obj) Deprecated.inspect()
RubyMethod inspect.default IRubyObject
inspect
(ThreadContext context) boolean
isClass()
If is_a? semantics is required, use(someObject instanceof RubyClass/MetaClass)
instead.boolean
isFrozen()
RubyMethod isFrozen.boolean
Is this an immediate objectboolean
isModule()
If is_a? semantics is required, use(someObject instanceof RubyModule)
instead.boolean
isNil()
Check whether this object is nil.boolean
Is this a special constantboolean
isTaint()
Deprecated.boolean
isTrue()
Check whether this object is truthy.boolean
RubyMethod isUntrusted.default void
marshalLiveVariables
(MarshalDumper stream, ThreadContext context, RubyOutputStream out) op_eqq
(ThreadContext context, IRubyObject other) op_equal
(ThreadContext context, IRubyObject other) rbClone()
RubyMethod clone.void
boolean
respondsTo
(String string) RubyMethod respondsTo.boolean
respondsToMissing
(String string) RubyMethod respondsTo.boolean
respondsToMissing
(String string, boolean priv) RubyMethod respondsTo.void
setFrozen
(boolean b) RubyMethod setFrozen.void
setTaint
(boolean taint) Deprecated.void
setUntrusted
(boolean b) RubyMethod setUntrusted.void
setVariable
(int index, Object value) default RubyClass
singletonClass
(ThreadContext context) void
syncVariables
(List<Variable<Object>> variables) Deprecated.void
syncVariables
(IRubyObject source) Sets object's variables to those in the supplied object, removing/replacing any previously defined variables of the same name.<T> T
Convert 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. MRI: NIL_P macro- Returns:
- true for
nil
only
-
isTrue
boolean isTrue()Check whether this object is truthy.- Returns:
- false for
nil
andfalse
, true otherwise
-
isFrozen
boolean isFrozen()RubyMethod isFrozen.- Returns:
- boolean
-
setFrozen
void setFrozen(boolean b) RubyMethod setFrozen.- Parameters:
b
- boolean
-
isUntrusted
boolean isUntrusted()RubyMethod isUntrusted.- Returns:
- boolean
-
setUntrusted
void setUntrusted(boolean b) RubyMethod setUntrusted.- Parameters:
b
- boolean
-
isImmediate
boolean isImmediate()Is this an immediate object- Returns:
- boolean
-
isSpecialConst
boolean isSpecialConst()Is this a special constant- Returns:
- boolean
-
getMetaClass
RubyClass getMetaClass()Retrieveself.class
.- Returns:
- the Ruby (meta) class
-
getSingletonClass
RubyClass getSingletonClass()Retrieveself.singleton_class
.- Returns:
- the Ruby singleton class
-
singletonClass
-
getType
RubyClass getType()RubyMethod getType.- Returns:
- RubyClass
-
respondsTo
RubyMethod respondsTo.- Parameters:
string
- method name- Returns:
- boolean
-
respondsToMissing
RubyMethod respondsTo.- Parameters:
string
- method name- Returns:
- boolean
-
respondsToMissing
RubyMethod respondsTo.- Parameters:
string
- method namepriv
- private?- 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:
- string representation
-
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()make this object into a string (hopefully)- Returns:
- a string value
-
checkStringType
IRubyObject checkStringType()is this a string if so return it otherwise nil- Returns:
- nil if type check failed
-
checkArrayType
IRubyObject checkArrayType()is this an array if so return it otherwise nil- Returns:
- nil if type check failed
-
toJava
Convert the object to the specified Java class, if possible.- Type Parameters:
T
- type- Parameters:
type
- The target type to which the object should be converted.- Returns:
- java type
-
dup
IRubyObject dup()RubyMethod dup.- Returns:
- a dup-ed object
-
dup
RubyMethod dup.- Parameters:
context
- the thread context- Returns:
- a dup-ed object
- Since:
- 10.0
-
inspect
IRubyObject inspect()RubyMethod inspect.- Returns:
- String
-
inspect
-
rbClone
IRubyObject rbClone()RubyMethod clone.- Returns:
- a cloned object
-
isModule
boolean isModule()If is_a? semantics is required, use(someObject instanceof RubyModule)
instead.- Returns:
- true if an object is Ruby Module instance (note that it will return false for Ruby Classes).
-
isClass
boolean isClass()If is_a? semantics is required, use(someObject instanceof RubyClass/MetaClass)
instead.- Returns:
- true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes).
-
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()The id of the object- Returns:
- the object id
-
op_equal
-
op_eqq
-
eql
-
addFinalizer
Deprecated. -
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()how many variables?- 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
list of all variables- Returns:
- a list of all variables (ivar/internal)
-
getMarshalVariableList
all marshable values- Returns:
- a mutable list of all marshalable variables (ivar/internal)
-
marshalLiveVariables
default void marshalLiveVariables(MarshalDumper stream, ThreadContext context, RubyOutputStream out) -
getInstanceVariables
InstanceVariables getInstanceVariables() -
getInternalVariables
InternalVariables getInternalVariables() -
getVariableNameList
list of all variable names- Returns:
- a list of all variable names (ivar/cvar/constant/internal)
-
copySpecialInstanceVariables
-
getVariable
-
setVariable
-
checkStringType19
Deprecated.UsecheckStringType()
instead.is this a string?- Returns:
- the string if so
-
convertToInteger
Deprecated.convert this object to an integer- Parameters:
convertMethodIndex
- indexconvertMethod
- conversion method name- Returns:
- integer
- See Also:
-
isTaint
Deprecated. -
setTaint
Deprecated. -
infectBy
Deprecated.
-
checkStringType()
instead.