org.jruby.runtime.builtin
Interface IRubyObject

All Known Subinterfaces:
JavaProxyMethod
All Known Implementing Classes:
IncludedModuleWrapper, JavaAccessibleObject, JavaArray, JavaCallable, JavaClass, JavaConstructor, JavaField, JavaMethod, JavaObject, JavaProxyClass, JavaProxyClass.ProxyMethodImpl, JavaProxyConstructor, JavaProxyReflectionObject, MetaClass, MockRubyObject, NativeException, RubyArgsFile, RubyArray, RubyBasicSocket, RubyBigDecimal, RubyBignum, RubyBinding, RubyBoolean, RubyClass, RubyClassPathVariable, RubyDigest.Base, RubyDir, RubyEnumerator, RubyException, RubyFile, RubyFileStat, RubyFixnum, RubyFloat, RubyHash, RubyIconv, RubyIconv.RubyFailure, RubyInteger, RubyIO, RubyIPSocket, RubyLocalJumpError, RubyMatchData, RubyMatchData.JavaString, RubyMatchData.RString, RubyMethod, RubyModule, RubyNameError, RubyNil, RubyNoMethodError, RubyNumeric, RubyObject, RubyProc, RubyProcess.RubyStatus, RubyRange, RubyRegexp, RubySocket, RubyString, RubyStringIO, RubyStringScanner, RubyStruct, RubySymbol, RubySystemExit, RubyTCPServer, RubyTCPSocket, RubyThread, RubyThreadGroup, RubyTime, RubyUnboundMethod, RubyUndef, RubyZlib.Deflate, RubyZlib.Inflate, RubyZlib.RubyGzipFile, RubyZlib.RubyGzipReader, RubyZlib.RubyGzipWriter, RubyZlib.ZStream, ThreadLibrary.ConditionVariable, ThreadLibrary.Mutex, ThreadLibrary.Queue, ThreadLibrary.SizedQueue

public interface IRubyObject

Object is the parent class of all classes in Ruby. Its methods are therefore available to all objects unless explicitly overridden.

Author:
jpetersen

Field Summary
static IRubyObject[] NULL_ARRAY
           
 
Method Summary
 void addFinalizer(RubyProc finalizer)
           
 IRubyObject anyToString()
           
 RubyString asString()
          rb_obj_as_string
 java.lang.String asSymbol()
          Convert the object into a symbol name if possible.
 IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String string)
           
 IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String name, IRubyObject arg)
           
 IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String name, IRubyObject[] args)
           
 IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String name, IRubyObject[] args, CallType callType)
           
 IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, int methodIndex, java.lang.String name, IRubyObject[] args, CallType callType, Block block)
           
 IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, java.lang.String name, IRubyObject[] args, CallType callType, Block block)
           
 IRubyObject callMethod(ThreadContext context, java.lang.String string)
           
 IRubyObject callMethod(ThreadContext context, java.lang.String string, Block aBlock)
           
 IRubyObject callMethod(ThreadContext context, java.lang.String string, IRubyObject arg)
           
 IRubyObject callMethod(ThreadContext context, java.lang.String method, IRubyObject[] rubyArgs)
           
 IRubyObject callMethod(ThreadContext context, java.lang.String method, IRubyObject[] rubyArgs, Block block)
           
 IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject[] args, CallType callType)
           
 IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject[] args, CallType callType, Block block)
           
 IRubyObject callSuper(ThreadContext context, IRubyObject[] args, Block block)
           
 IRubyObject checkArrayType()
           
 IRubyObject checkStringType()
           
 IRubyObject compilerCallMethod(ThreadContext context, java.lang.String name, IRubyObject[] args, IRubyObject caller, CallType callType, Block block)
           
 IRubyObject compilerCallMethodWithIndex(ThreadContext context, int methodIndex, java.lang.String name, IRubyObject[] args, IRubyObject caller, CallType callType, Block block)
           
 RubyArray convertToArray()
          Methods which perform to_xxx if the object has such a method
 RubyFloat convertToFloat()
           
 RubyHash convertToHash()
           
 RubyInteger convertToInteger()
           
 RubyString convertToString()
           
 IRubyObject convertToType(RubyClass targetType, int convertMethodIndex, java.lang.String convertMethod, boolean raiseOnError)
          Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type).
 IRubyObject convertToType(RubyClass targetType, int convertMethodIndex, java.lang.String convertMethod, boolean raiseOnMissingMethod, boolean raiseOnWrongTypeResult, boolean allowNilThrough)
           
 IRubyObject convertToTypeWithCheck(RubyClass targetType, int convertMethodIndex, java.lang.String convertMethod)
          Higher level conversion utility similiar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).
 java.lang.Object dataGetStruct()
          Our version of Data_Get_Struct.
 void dataWrapStruct(java.lang.Object obj)
          Our version of Data_Wrap_Struct.
 IRubyObject dup()
          RubyMethod dup.
 boolean eql(IRubyObject other)
           
 boolean eqlInternal(ThreadContext context, IRubyObject other)
           
 IRubyObject equal(IRubyObject other)
           
 IRubyObject equalInternal(ThreadContext context, IRubyObject other)
           
 IRubyObject evalSimple(ThreadContext context, IRubyObject evalString, java.lang.String file)
          Evaluate the given string.
 IRubyObject evalWithBinding(ThreadContext context, IRubyObject evalString, IRubyObject binding, java.lang.String file, int lineNumber)
          Evaluate the given string under the specified binding object.
 IRubyObject getInstanceVariable(java.lang.String string)
          RubyMethod getInstanceVar.
 java.util.Map getInstanceVariables()
           
 java.util.Map getInstanceVariablesSnapshot()
           
 java.lang.Class getJavaClass()
          RubyMethod getJavaClass.
 RubyClass getMetaClass()
          RubyMethod getRubyClass.
 int getNativeTypeIndex()
          Return the ClassIndex value for the native type this object was constructed from.
 Ruby getRuntime()
          RubyMethod getRuntime.
 RubyClass getSingletonClass()
          RubyMethod getSingletonClass.
 RubyClass getType()
          RubyMethod getType.
 RubyFixnum id()
           
 IRubyObject infectBy(IRubyObject obj)
          Infect this object using the taint of another object
 IRubyObject inspect()
          RubyMethod inspect.
 java.util.Iterator instanceVariableNames()
           
 boolean isFrozen()
          RubyMethod isFrozen.
 boolean isImmediate()
           
 boolean isKindOf(RubyModule rubyClass)
          RubyMethod isKindOf.
 boolean isNil()
          RubyMethod isNil.
 boolean isSingleton()
           
 boolean isTaint()
          RubyMethod isTaint.
 boolean isTrue()
           
 IRubyObject rbClone(Block unusedBlock)
          RubyMethod rbClone.
 void removeFinalizers()
           
 boolean respondsTo(java.lang.String string)
          RubyMethod respondsTo.
 java.util.Map safeGetInstanceVariables()
          Gets a copy of the instance variables for this object, if any exist.
 boolean safeHasInstanceVariables()
          Returns true if the object has any instance variables, false otherwise.
 void setFrozen(boolean b)
          RubyMethod setFrozen.
 IRubyObject setInstanceVariable(java.lang.String string, IRubyObject rubyObject)
          RubyMethod setInstanceVar.
 void setInstanceVariables(java.util.Map instanceVariables)
           
 void setMetaClass(RubyClass metaClass)
           
 void setTaint(boolean b)
          RubyMethod setTaint.
 

Field Detail

NULL_ARRAY

static final IRubyObject[] NULL_ARRAY
Method Detail

getNativeTypeIndex

int getNativeTypeIndex()
Return the ClassIndex value for the native type this object was constructed from. Particularly useful for determining marshalling format. All instances of subclasses of Hash, for example are of Java type RubyHash, and so should utilize RubyHash marshalling logic in addition to user-defined class marshalling logic.

Returns:
the ClassIndex of the native type this object was constructed from

safeGetInstanceVariables

java.util.Map safeGetInstanceVariables()
Gets a copy of the instance variables for this object, if any exist. Returns null if this object has no instance variables. "safe" in that it doesn't cause the instance var map to be created.

Returns:
A snapshot of the instance vars, or null if none.

safeHasInstanceVariables

boolean safeHasInstanceVariables()
Returns true if the object has any instance variables, false otherwise. "safe" in that it doesn't cause the instance var map to be created.

Returns:
true if the object has instance variables, false otherwise.

getInstanceVariable

IRubyObject getInstanceVariable(java.lang.String string)
RubyMethod getInstanceVar.

Parameters:
string -
Returns:
RubyObject

setInstanceVariable

IRubyObject setInstanceVariable(java.lang.String string,
                                IRubyObject rubyObject)
RubyMethod setInstanceVar.

Parameters:
string -
rubyObject -
Returns:
RubyObject

getInstanceVariables

java.util.Map getInstanceVariables()
Returns:

setInstanceVariables

void setInstanceVariables(java.util.Map instanceVariables)
Parameters:
instanceVariables -

getInstanceVariablesSnapshot

java.util.Map getInstanceVariablesSnapshot()
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       RubyModule rubyclass,
                       java.lang.String name,
                       IRubyObject[] args,
                       CallType callType,
                       Block block)
Parameters:
context -
rubyclass -
name -
args -
callType -
block -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       RubyModule rubyclass,
                       int methodIndex,
                       java.lang.String name,
                       IRubyObject[] args,
                       CallType callType,
                       Block block)
Parameters:
context -
rubyclass -
methodIndex -
name -
args -
callType -
block -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       int methodIndex,
                       java.lang.String name,
                       IRubyObject arg)
Parameters:
context -
methodIndex -
name -
arg -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       int methodIndex,
                       java.lang.String name,
                       IRubyObject[] args)
Parameters:
context -
methodIndex -
name -
args -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       int methodIndex,
                       java.lang.String name,
                       IRubyObject[] args,
                       CallType callType)
Parameters:
context -
methodIndex -
name -
args -
callType -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       java.lang.String name,
                       IRubyObject[] args,
                       CallType callType)
Parameters:
context -
name -
args -
callType -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       java.lang.String name,
                       IRubyObject[] args,
                       CallType callType,
                       Block block)
Parameters:
context -
name -
args -
callType -
block -
Returns:

compilerCallMethod

IRubyObject compilerCallMethod(ThreadContext context,
                               java.lang.String name,
                               IRubyObject[] args,
                               IRubyObject caller,
                               CallType callType,
                               Block block)
Parameters:
context -
name -
args -
caller -
callType -
block -
Returns:

compilerCallMethodWithIndex

IRubyObject compilerCallMethodWithIndex(ThreadContext context,
                                        int methodIndex,
                                        java.lang.String name,
                                        IRubyObject[] args,
                                        IRubyObject caller,
                                        CallType callType,
                                        Block block)
Parameters:
context -
methodIndex -
name -
args -
caller -
callType -
block -
Returns:

callSuper

IRubyObject callSuper(ThreadContext context,
                      IRubyObject[] args,
                      Block block)
Parameters:
context -
args -
block -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       java.lang.String string)
Parameters:
context -
string -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       int methodIndex,
                       java.lang.String string)
Parameters:
context -
string -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       java.lang.String string,
                       Block aBlock)
Parameters:
context -
string -
aBlock -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       java.lang.String string,
                       IRubyObject arg)
Parameters:
context -
string -
arg -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       java.lang.String method,
                       IRubyObject[] rubyArgs)
Parameters:
context -
method -
rubyArgs -
Returns:

callMethod

IRubyObject callMethod(ThreadContext context,
                       java.lang.String method,
                       IRubyObject[] rubyArgs,
                       Block block)
Parameters:
context -
method -
rubyArgs -
block -
Returns:

isNil

boolean isNil()
RubyMethod isNil.

Returns:
boolean

isTrue

boolean isTrue()
Returns:

isTaint

boolean isTaint()
RubyMethod isTaint.

Returns:
boolean

setTaint

void setTaint(boolean b)
RubyMethod setTaint.

Parameters:
b -

isFrozen

boolean isFrozen()
RubyMethod isFrozen.

Returns:
boolean

setFrozen

void setFrozen(boolean b)
RubyMethod setFrozen.

Parameters:
b -

isImmediate

boolean isImmediate()
Returns:

isKindOf

boolean isKindOf(RubyModule rubyClass)
RubyMethod isKindOf.

Parameters:
rubyClass -
Returns:
boolean

infectBy

IRubyObject infectBy(IRubyObject obj)
Infect this object using the taint of another object

Parameters:
obj -
Returns:

getMetaClass

RubyClass getMetaClass()
RubyMethod getRubyClass.

Returns:

setMetaClass

void setMetaClass(RubyClass metaClass)
Parameters:
metaClass -

getSingletonClass

RubyClass getSingletonClass()
RubyMethod getSingletonClass.

Returns:
RubyClass

getType

RubyClass getType()
RubyMethod getType.

Returns:
RubyClass

respondsTo

boolean respondsTo(java.lang.String string)
RubyMethod respondsTo.

Parameters:
string -
Returns:
boolean

getRuntime

Ruby getRuntime()
RubyMethod getRuntime.

Returns:

getJavaClass

java.lang.Class getJavaClass()
RubyMethod getJavaClass.

Returns:
Class

evalWithBinding

IRubyObject evalWithBinding(ThreadContext context,
                            IRubyObject evalString,
                            IRubyObject binding,
                            java.lang.String file,
                            int lineNumber)
Evaluate the given string under the specified binding object. If the binding is not a Proc or Binding object (RubyProc or RubyBinding) throw an appropriate type error.

Parameters:
context - TODO
evalString - The string containing the text to be evaluated
binding - The binding object under which to perform the evaluation
file - The filename to use when reporting errors during the evaluation
lineNumber - is the line number to pretend we are starting from
Returns:
An IRubyObject result from the evaluation

evalSimple

IRubyObject evalSimple(ThreadContext context,
                       IRubyObject evalString,
                       java.lang.String file)
Evaluate the given string.

Parameters:
context - TODO
evalString - The string containing the text to be evaluated
file - The filename to use when reporting errors during the evaluation
Returns:
An IRubyObject result from the evaluation

asSymbol

java.lang.String asSymbol()
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()
Methods which perform to_xxx if the object has such a method

Returns:

convertToHash

RubyHash convertToHash()
Returns:

convertToFloat

RubyFloat convertToFloat()
Returns:

convertToInteger

RubyInteger convertToInteger()
Returns:

convertToString

RubyString convertToString()
Returns:

convertToType

IRubyObject convertToType(RubyClass targetType,
                          int convertMethodIndex,
                          java.lang.String convertMethod,
                          boolean raiseOnError)
Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type).

Parameters:
targetType - is the type we are trying to convert to
convertMethod - is the method to be called to try and convert to targeType
raiseOnError - will throw an Error if conversion does not work
Returns:
the converted value

convertToTypeWithCheck

IRubyObject convertToTypeWithCheck(RubyClass targetType,
                                   int convertMethodIndex,
                                   java.lang.String convertMethod)
Higher level conversion utility similiar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).

Parameters:
targetType - is the type we are trying to convert to
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value

convertToType

IRubyObject convertToType(RubyClass targetType,
                          int convertMethodIndex,
                          java.lang.String convertMethod,
                          boolean raiseOnMissingMethod,
                          boolean raiseOnWrongTypeResult,
                          boolean allowNilThrough)
Parameters:
targetType -
convertMethod -
raiseOnMissingMethod -
raiseOnWrongTypeResult -
allowNilThrough -
Returns:

anyToString

IRubyObject anyToString()
Returns:

checkStringType

IRubyObject checkStringType()
Returns:

checkArrayType

IRubyObject checkArrayType()
Returns:

dup

IRubyObject dup()
RubyMethod dup.

Returns:

inspect

IRubyObject inspect()
RubyMethod inspect.

Returns:
String

rbClone

IRubyObject rbClone(Block unusedBlock)
RubyMethod rbClone.

Returns:
IRubyObject

isSingleton

boolean isSingleton()
Returns:

instanceVariableNames

java.util.Iterator instanceVariableNames()
Returns:

dataWrapStruct

void dataWrapStruct(java.lang.Object obj)
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

java.lang.Object dataGetStruct()
Our version of Data_Get_Struct. Returns a wrapped data value if there is one, otherwise returns null.

Returns:
the object wrapped.

id

RubyFixnum id()
Returns:

equal

IRubyObject equal(IRubyObject other)

equalInternal

IRubyObject equalInternal(ThreadContext context,
                          IRubyObject other)

eql

boolean eql(IRubyObject other)

eqlInternal

boolean eqlInternal(ThreadContext context,
                    IRubyObject other)

addFinalizer

void addFinalizer(RubyProc finalizer)

removeFinalizers

void removeFinalizers()


Copyright © 2002-2007 JRuby Team. All Rights Reserved.