org.jruby
Class RubyBasicObject

java.lang.Object
  extended by org.jruby.RubyBasicObject
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<IRubyObject>, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType
Direct Known Subclasses:
RubyObject

public class RubyBasicObject
extends java.lang.Object
implements java.lang.Cloneable, IRubyObject, java.io.Serializable, java.lang.Comparable<IRubyObject>, CoreObjectType, InstanceVariables, InternalVariables

Author:
enebo
See Also:
Serialized Form

Nested Class Summary
static class RubyBasicObject.Finalizer
          Class that keeps track of the finalizers for the object under operation.
 
Field Summary
static int ALL_F
           
static ObjectAllocator BASICOBJECT_ALLOCATOR
          Default allocator instance for all Ruby objects.
static int COMPARE_BY_IDENTITY_F
           
protected static java.lang.String ERR_INSECURE_SET_INST_VAR
          The error message used when some one tries to modify an instance variable in a high security setting.
static int FALSE_F
           
static int FL_USHIFT
           
protected  int flags
           
static int FROZEN_F
           
protected  RubyClass metaClass
           
static IRubyObject NEVER
          A value that is used as a null sentinel in among other places the RubyArray implementation.
static int NIL_F
          This flag is a bit funny.
static int TAINTED_F
           
static IRubyObject UNDEF
          A value that specifies an undefined value.
static int UNTRUSTED_F
           
static int USER0_F
           
static int USER1_F
           
static int USER2_F
           
static int USER3_F
           
static int USER4_F
           
static int USER5_F
           
static int USER6_F
           
static int USER7_F
           
static int USER8_F
           
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Constructor Summary
  RubyBasicObject(RubyClass metaClass)
          Path for objects that don't taint and don't enter objectspace.
  RubyBasicObject(Ruby runtime, RubyClass metaClass)
          Standard path for object creation.
protected RubyBasicObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace)
           
protected RubyBasicObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace, boolean canBeTainted)
          Path for objects who want to decide whether they don't want to be in ObjectSpace even when it is on.
 
Method Summary
 void addFinalizer(IRubyObject f)
          Adds the specified object as a finalizer for this object.
 IRubyObject anyToString()
          Internal method that helps to convert any object into the format of a class name and a hex string inside of #<>.
 java.lang.String asJavaString()
          rb_to_id Will try to convert this object to a String using the Ruby "to_str" if the object isn't already a String.
 RubyString asString()
          rb_obj_as_string First converts this object into a String using the "to_s" method, infects it with the current taint and returns it.
 IRubyObject callMethod(java.lang.String name)
           
 IRubyObject callMethod(java.lang.String name, IRubyObject... args)
           
 IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String name)
          Deprecated. 
 IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String name, IRubyObject arg)
          Deprecated. 
 IRubyObject callMethod(ThreadContext context, java.lang.String name)
          Will invoke a named method with no arguments and no block.
 IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject arg)
          Will invoke a named method with one argument and no block with functional invocation.
 IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject[] args)
          Will invoke a named method with the supplied arguments and no block with functional invocation.
 IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject[] args, Block block)
          Will invoke a named method with the supplied arguments and supplied block with functional invocation.
 IRubyObject callSuper(ThreadContext context, IRubyObject[] args, Block block)
          Deprecated. 
 IRubyObject checkArrayType()
          rb_check_array_type Returns the result of trying to convert this object to an Array with "to_ary".
 IRubyObject checkCallMethod(ThreadContext context, java.lang.String name)
          Will invoke a named method with no arguments and no block if that method or a custom method missing exists.
protected  void checkFrozen()
          The actual method that checks frozen with the default frozen message from MRI.
 IRubyObject checkStringType()
          rb_check_string_type Tries to return a coerced string representation of this object, using "to_str".
 IRubyObject checkStringType19()
          rb_check_string_type Tries to return a coerced string representation of this object, using "to_str".
 int compareTo(IRubyObject other)
           
 RubyArray convertToArray()
          Tries to convert this object to a Ruby Array using the "to_ary" method.
 RubyFloat convertToFloat()
          Tries to convert this object to a Ruby Float using the "to_f" method.
 RubyHash convertToHash()
          Tries to convert this object to a Ruby Hash using the "to_hash" method.
 RubyInteger convertToInteger()
          Tries to convert this object to a Ruby Integer using the "to_int" method.
 RubyInteger convertToInteger(int methodIndex, java.lang.String convertMethod)
          Deprecated. 
 RubyInteger convertToInteger(java.lang.String convertMethod)
          Tries to convert this object to a Ruby Integer using the supplied conversion method.
 RubyString convertToString()
          Tries to convert this object to a Ruby String using the "to_str" method.
 void copyInstanceVariablesInto(InstanceVariables other)
          Copies all instance variables from the given object into the receiver
 void copySpecialInstanceVariables(IRubyObject clone)
          Lots of MRI objects keep their state in non-lookupable ivars (e:g.
static RubyClass createBasicObjectClass(Ruby runtime, RubyClass objectClass)
          Will create the Ruby class Object in the runtime specified.
 java.lang.Object dataGetStruct()
          Our version of Data_Get_Struct.
 java.lang.Object dataGetStructChecked()
           
 void dataWrapStruct(java.lang.Object obj)
          Our version of Data_Wrap_Struct.
 IRubyObject display(ThreadContext context, IRubyObject[] args)
          rb_obj_display call-seq: obj.display(port=$>) => nil Prints obj on the given port (default $>).
 IRubyObject dup()
          RubyMethod dup.
protected  void ensureInstanceVariablesSettable()
          Makes sure that instance variables can be set on this object, including information about whether this object is frozen, or tainted.
 IRubyObject eql_p(IRubyObject obj)
          rb_obj_equal Just like "==" and "equal?", "eql?" will use identity equality for Object.
 boolean eql(IRubyObject other)
          method used for Hash key comparison (specialized for String, Symbol and Fixnum) Will by default just call the Ruby method "eql?"
 IRubyObject equal_p(ThreadContext context, IRubyObject obj)
          rb_obj_equal Will use Java identity equality.
 IRubyObject equal_p19(ThreadContext context, IRubyObject other)
           
protected static boolean equalInternal(ThreadContext context, IRubyObject that, IRubyObject other)
          Helper method for checking equality, first using Java identity equality, and then calling the "==" method.
 IRubyObject evalUnder(ThreadContext context, RubyModule under, RubyString src, java.lang.String file, int line)
          Evaluates the string src with self set to the current object, using the module under as the context.
 IRubyObject extend(IRubyObject[] args)
          rb_obj_extend call-seq: obj.extend(module, ...) => obj Adds to _obj_ the instance methods from each module given as a parameter.
 IRubyObject fastGetInstanceVariable(java.lang.String internedName)
          Returns the named instance variable if present, else null.
 java.lang.Object fastGetInternalVariable(java.lang.String internedName)
          Returns the named internal variable if present, else null.
 boolean fastHasInstanceVariable(java.lang.String internedName)
          Returns true if object has the named instance variable.
 boolean fastHasInternalVariable(java.lang.String internedName)
          Returns true if object has the named internal variable.
 IRubyObject fastSetInstanceVariable(java.lang.String internedName, IRubyObject value)
          Sets the named instance variable to the specified value.
 void fastSetInternalVariable(java.lang.String internedName, java.lang.Object value)
          Sets the named internal variable to the specified value.
 IRubyObject freeze(ThreadContext context)
          rb_obj_freeze call-seq: obj.freeze => obj Prevents further modifications to obj.
 RubyBoolean frozen_p(ThreadContext context)
          rb_obj_frozen_p call-seq: obj.frozen? => true or false Returns the freeze status of obj.
 boolean getFlag(int flag)
          Get the value of a custom flag on this object.
protected  RubyModule getInstanceEvalClass()
           
 IRubyObject getInstanceVariable(java.lang.String name)
          Returns the named instance variable if present, else null.
 java.util.List<Variable<IRubyObject>> getInstanceVariableList()
          Gets a list of all variables in this object.
 java.util.List<java.lang.String> getInstanceVariableNameList()
          Gets a name list of all variables in this object.
 InstanceVariables getInstanceVariables()
          Dummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.
 java.lang.Object getInternalVariable(java.lang.String name)
          Returns the named internal variable if present, else null.
 InternalVariables getInternalVariables()
          Dummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.
 java.lang.Class getJavaClass()
          Will return the Java interface that most closely can represent this object, when working through JAva integration translations.
 RubyClass getMetaClass()
          if exist return the meta-class else return the type of the object.
 int getNativeTypeIndex()
          Return the ClassIndex value for the native type this object was constructed from.
protected  long getObjectId()
          The logic here is to use the special objectId accessor slot from the parent as a lazy store for an object ID.
 Ruby getRuntime()
          Will return the runtime that this object is associated with.
 RubyClass getSingletonClass()
          rb_singleton_class Note: this method is specialized for RubyFixnum, RubySymbol, RubyNil and RubyBoolean Will either return the existing singleton class for this object, or create a new one and return that.
protected  RubyClass getSingletonClassClone()
          rb_singleton_class_clone Will make sure that if the current objects class is a singleton, it will get cloned.
 RubyClass getType()
          RubyMethod getType.
 java.lang.Object getVariable(int index)
           
 int getVariableCount()
          Deprecated. 
 java.util.List<Variable<java.lang.Object>> getVariableList()
          Gets a list of all variables in this object.
 java.util.List<java.lang.String> getVariableNameList()
          Gets a name list of all variables in this object.
 RubyFixnum hash()
          rb_obj_id Will return the hash code of this object.
 IRubyObject hashyInspect()
           
 boolean hasInstanceVariable(java.lang.String name)
          Returns true if object has the named instance variable.
 boolean hasInternalVariable(java.lang.String name)
          Returns true if object has the named internal variable.
 boolean hasVariables()
          Returns true if object has any variables, defined as: instance variables class variables constants internal variables, such as those used when marshaling Ranges and Exceptions
 IRubyObject id_deprecated()
          rb_obj_id_obsolete Old id version.
 IRubyObject id()
          rb_obj_id Return the internal id of an object.
 IRubyObject infectBy(IRubyObject obj)
          OBJ_INFECT Infects this object with traits from the argument obj.
 IRubyObject initialize_copy(IRubyObject original)
          rb_obj_init_copy Initializes this object as a copy of the original, that is the parameter to this object.
 IRubyObject initialize()
           
 IRubyObject initialize19()
           
 IRubyObject initialize19(IRubyObject arg0)
           
 IRubyObject initialize19(IRubyObject[] args)
           
 IRubyObject initialize19(IRubyObject arg0, IRubyObject arg1)
           
 IRubyObject initialize19(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
           
protected  long initObjectId(RubyClass.VariableAccessor objectIdAccessor)
          We lazily stand up the object ID since it forces us to stand up per-object state for a given object.
 IRubyObject inspect()
          rb_obj_inspect call-seq: obj.inspect => string Returns a string containing a human-readable representation of obj.
protected  int inspectHashCode()
          For most objects, the hash used in the default #inspect is just the identity hashcode of the actual object.
 IRubyObject instance_eval(ThreadContext context, Block block)
          rb_obj_instance_eval call-seq: obj.instance_eval(string [, filename [, lineno]] ) => obj obj.instance_eval {| | block } => obj Evaluates a string containing Ruby source code, or the given block, within the context of the receiver (_obj_).
 IRubyObject instance_eval(ThreadContext context, IRubyObject arg0, Block block)
           
 IRubyObject instance_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
           
 IRubyObject instance_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
           
 IRubyObject instance_eval19(ThreadContext context, Block block)
           
 IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, Block block)
           
 IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
           
 IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
           
 IRubyObject instance_exec(ThreadContext context, IRubyObject[] args, Block block)
          rb_obj_instance_exec call-seq: obj.instance_exec(arg...) {|var...| block } => obj Executes the given block within the context of the receiver (_obj_).
 IRubyObject instance_exec19(ThreadContext context, IRubyObject[] args, Block block)
           
 RubyBoolean instance_of_p(ThreadContext context, IRubyObject type)
          rb_obj_is_instance_of call-seq: obj.instance_of?(class) => true or false Returns true if obj is an instance of the given class.
 IRubyObject instance_variable_defined_p(ThreadContext context, IRubyObject name)
          rb_obj_ivar_defined call-seq: obj.instance_variable_defined?(symbol) => true or false Returns true if the given instance variable is defined in obj.
 IRubyObject instance_variable_get(ThreadContext context, IRubyObject name)
          rb_obj_ivar_get call-seq: obj.instance_variable_get(symbol) => obj Returns the value of the given instance variable, or nil if the instance variable is not set.
 IRubyObject instance_variable_set(IRubyObject name, IRubyObject value)
          rb_obj_ivar_set call-seq: obj.instance_variable_set(symbol, obj) => obj Sets the instance variable names by symbol to object, thereby frustrating the efforts of the class's author to attempt to provide proper encapsulation.
 RubyArray instance_variables(ThreadContext context)
          rb_obj_instance_variables call-seq: obj.instance_variables => array Returns an array of instance variable names for the receiver.
 RubyArray instance_variables19(ThreadContext context)
           
 boolean isBuiltin(java.lang.String methodName)
          A method to determine whether the method named by methodName is a builtin method.
 boolean isClass()
          Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.
 boolean isFalse()
          Is this value a false value or not? Based on the FALSE_F flag.
 boolean isFrozen()
          Is this value frozen or not? Shortcut for doing getFlag(FROZEN_F).
 boolean isImmediate()
          Is object immediate (def: Fixnum, Symbol, true, false, nil?).
 boolean isModule()
          Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.
 boolean isNil()
          Does this object represent nil? See the docs for the NIL_F flag for more information.
 boolean isTaint()
          Gets the taint.
 boolean isTrue()
          Is this value a true value or not? Based on the FALSE_F flag.
 boolean isUntrusted()
          Is this value untrusted or not? Shortcut for doing getFlag(UNTRUSTED_F).
 RubyBoolean kind_of_p(ThreadContext context, IRubyObject type)
          rb_obj_is_kind_of call-seq: obj.is_a?(class) => true or false obj.kind_of?(class) => true or false Returns true if class is the class of obj, or if class is one of the superclasses of obj or modules included in obj.
 RubyClass makeMetaClass(RubyClass superClass)
          rb_make_metaclass Will create a new meta class, insert this in the chain of classes for this specific object, and return the generated meta class.
static IRubyObject method_missing19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block)
           
 IRubyObject method(IRubyObject symbol)
          rb_obj_method call-seq: obj.method(sym) => method Looks up the named method as a receiver in obj, returning a Method object (or raising NameError).
 IRubyObject method19(IRubyObject symbol)
           
 IRubyObject methods(ThreadContext context, IRubyObject[] args)
          rb_obj_methods call-seq: obj.methods => array Returns a list of the names of methods publicly accessible in obj.
 IRubyObject methods(ThreadContext context, IRubyObject[] args, boolean useSymbols)
           
 IRubyObject methods19(ThreadContext context, IRubyObject[] args)
           
 IRubyObject nil_p(ThreadContext context)
          rb_false call_seq: nil.nil? => true .nil? => false Only the object nil responds true to nil?.
 IRubyObject op_cmp(ThreadContext context, IRubyObject other)
           
 IRubyObject op_eqq(ThreadContext context, IRubyObject other)
           
 IRubyObject op_equal_19(ThreadContext context, IRubyObject obj)
          rb_obj_equal Will by default use identity equality to compare objects.
 IRubyObject op_equal(ThreadContext context, IRubyObject obj)
           
 IRubyObject op_match(ThreadContext context, IRubyObject arg)
          rb_obj_pattern_match call-seq: obj =~ other => false Pattern Match---Overridden by descendents (notably Regexp and String) to provide meaningful pattern-match semantics.
 IRubyObject op_match19(ThreadContext context, IRubyObject arg)
           
 IRubyObject op_not_equal(ThreadContext context, IRubyObject other)
           
 IRubyObject op_not_match(ThreadContext context, IRubyObject arg)
           
 IRubyObject op_not(ThreadContext context)
           
 IRubyObject private_methods(ThreadContext context, IRubyObject[] args)
          rb_obj_private_methods call-seq: obj.private_methods(all=true) => array Returns the list of private methods accessible to obj.
 IRubyObject private_methods19(ThreadContext context, IRubyObject[] args)
           
 IRubyObject protected_methods(ThreadContext context, IRubyObject[] args)
          rb_obj_protected_methods call-seq: obj.protected_methods(all=true) => array Returns the list of protected methods accessible to obj.
 IRubyObject protected_methods19(ThreadContext context, IRubyObject[] args)
           
 IRubyObject public_methods(ThreadContext context, IRubyObject[] args)
          rb_obj_public_methods call-seq: obj.public_methods(all=true) => array Returns the list of public methods accessible to obj.
 IRubyObject public_methods19(ThreadContext context, IRubyObject[] args)
           
 IRubyObject rbClone()
          RubyMethod rbClone.
 IRubyObject remove_instance_variable(ThreadContext context, IRubyObject name, Block block)
          rb_obj_remove_instance_variable call-seq: obj.remove_instance_variable(symbol) => obj Removes the named instance variable from obj, returning that variable's value.
 void removeFinalizers()
          Remove all the finalizers for this object.
 IRubyObject removeInstanceVariable(java.lang.String name)
          Removes the named instance variable, if present, returning its value.
 java.lang.Object removeInternalVariable(java.lang.String name)
          Removes the named internal variable, if present, returning its value.
 RubyBoolean respond_to_p(IRubyObject mname)
          obj_respond_to respond_to?( aSymbol, includePriv=false ) -> true or false Returns true if this object responds to the given method.
 RubyBoolean respond_to_p(IRubyObject mname, IRubyObject includePrivate)
          obj_respond_to respond_to?( aSymbol, includePriv=false ) -> true or false Returns true if this object responds to the given method.
 IRubyObject respond_to_p19(IRubyObject mname)
           
 IRubyObject respond_to_p19(IRubyObject mname, IRubyObject includePrivate)
           
 boolean respondsTo(java.lang.String name)
          Does this object respond to the specified message? Uses a shortcut if it can be proved that respond_to? haven't been overridden.
 boolean respondsToMissing(java.lang.String name)
          Does this object respond to the specified message via "method_missing?"
 boolean respondsToMissing(java.lang.String name, boolean priv)
          Does this object respond to the specified message via "method_missing?"
 IRubyObject send(ThreadContext context, Block block)
          rb_f_send send( aSymbol [, args ]* ) -> anObject Invokes the method identified by aSymbol, passing it any arguments specified.
 IRubyObject send(ThreadContext context, IRubyObject[] args, Block block)
           
 IRubyObject send(ThreadContext context, IRubyObject arg0, Block block)
           
 IRubyObject send(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
           
 IRubyObject send(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
           
 IRubyObject send19(ThreadContext context, Block block)
           
 IRubyObject send19(ThreadContext context, IRubyObject[] args, Block block)
           
 IRubyObject send19(ThreadContext context, IRubyObject arg0, Block block)
           
 IRubyObject send19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
           
 IRubyObject send19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
           
 void setFlag(int flag, boolean set)
          Sets or unsets a flag on this object.
 void setFrozen(boolean frozen)
          Sets whether this object is frozen or not.
 IRubyObject setInstanceVariable(java.lang.String name, IRubyObject value)
          rb_iv_set / rb_ivar_set
 void setInternalVariable(java.lang.String name, java.lang.Object value)
          Sets the named internal variable to the specified value.
 void setMetaClass(RubyClass metaClass)
          Makes it possible to change the metaclass of an object.
 void setTaint(boolean taint)
          Sets the taint flag.
 void setUntrusted(boolean untrusted)
          Sets whether this object is frozen or not.
 void setVariable(int index, java.lang.Object value)
           
static IRubyObject singleton_method_added19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
           
static IRubyObject singleton_method_removed19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
           
static IRubyObject singleton_method_undefined19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
           
 RubyArray singleton_methods(ThreadContext context, IRubyObject[] args)
          rb_obj_singleton_methods call-seq: obj.singleton_methods(all=true) => array Returns an array of the names of singleton methods for obj.
 RubyArray singleton_methods19(ThreadContext context, IRubyObject[] args)
           
 IRubyObject specificEval(ThreadContext context, RubyModule mod, Block block)
          specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.
 IRubyObject specificEval(ThreadContext context, RubyModule mod, IRubyObject arg, Block block)
          specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.
 IRubyObject specificEval(ThreadContext context, RubyModule mod, IRubyObject arg0, IRubyObject arg1, Block block)
          specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.
 IRubyObject specificEval(ThreadContext context, RubyModule mod, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
          specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.
 void syncVariables(IRubyObject other)
          Sync one this object's variables with other's - this is used to make rbClone work correctly.
 void syncVariables(java.util.List<Variable<java.lang.Object>> variables)
          Deprecated. 
protected  void taint(Ruby runtime)
           
 IRubyObject taint(ThreadContext context)
          rb_obj_taint call-seq: obj.taint -> obj Marks obj as tainted---if the $SAFE level is set appropriately, many method calls which might alter the running programs environment will refuse to accept tainted strings.
 RubyBoolean tainted_p(ThreadContext context)
          rb_obj_tainted call-seq: obj.tainted? => true or false Returns true if the object is tainted.
protected  void testFrozen()
          rb_frozen_class_p Helper to test whether this object is frozen, and if it is will throw an exception based on the message.
protected  void testFrozen(java.lang.String message)
          rb_frozen_class_p Helper to test whether this object is frozen, and if it is will throw an exception based on the message.
 RubyArray to_a()
          rb_any_to_a call-seq: obj.to_a -> anArray Returns an array representation of obj.
 IRubyObject to_s()
          rb_any_to_s call-seq: obj.to_s => string Returns a string representing obj.
 java.lang.Object toJava(java.lang.Class target)
          Convert the object to the specified Java class, if possible.
 IRubyObject trust(ThreadContext context)
          rb_obj_trust call-seq: obj.trust => obj Removes the untrusted mark from obj.
 RubyClass type_deprecated()
          rb_obj_type The deprecated version of type, that emits a deprecation warning.
 RubyClass type()
          rb_obj_class Returns the real class of this object, excluding any singleton/meta class in the inheritance chain.
 IRubyObject untaint(ThreadContext context)
          rb_obj_untaint call-seq: obj.untaint => obj Removes the taint from obj.
 IRubyObject untrust(ThreadContext context)
          rb_obj_untrust call-seq: obj.untrust -> obj Marks obj as untrusted.
 RubyBoolean untrusted_p(ThreadContext context)
          rb_obj_untrusted call-seq: obj.untrusted? => true or false Returns true if the object is untrusted.
protected  java.lang.String validateInstanceVariable(java.lang.String name)
          Checks if the name parameter represents a legal instance variable name, and otherwise throws a Ruby NameError
protected  boolean variableTableContains(java.lang.String name)
          Checks if the variable table contains a variable of the specified name.
protected  boolean variableTableFastContains(java.lang.String internedName)
          Checks if the variable table contains the the variable of the specified name, where the precondition is that the name must be an interned Java String.
protected  java.lang.Object variableTableFastFetch(java.lang.String internedName)
          Fetch an object from the variable table based on the name, where the name must be an interned Java String.
protected  java.lang.Object variableTableFastStore(java.lang.String internedName, java.lang.Object value)
          Will store the value under the specified name, where the name needs to be an interned Java String.
protected  java.lang.Object variableTableFetch(java.lang.String name)
          Fetch an object from the variable table based on the name.
protected  java.lang.Object variableTableRemove(java.lang.String name)
          Removes the entry with the specified name from the variable table, and returning the removed value.
protected  java.lang.Object variableTableStore(java.lang.String name, java.lang.Object value)
          Store a value in the variable store under the specific name.
protected  void variableTableSync(java.util.List<Variable<java.lang.Object>> vars)
          Synchronize the variable table with the argument.
protected  IRubyObject yieldUnder(ThreadContext context, RubyModule under, Block block)
          Will yield to the specific block changing the self to be the current object instead of the self that is part of the frame saved in the block frame.
protected  IRubyObject yieldUnder(ThreadContext context, RubyModule under, IRubyObject[] args, Block block)
          Will yield to the specific block changing the self to be the current object instead of the self that is part of the frame saved in the block frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metaClass

protected transient RubyClass metaClass

flags

protected int flags

ERR_INSECURE_SET_INST_VAR

protected static final java.lang.String ERR_INSECURE_SET_INST_VAR
The error message used when some one tries to modify an instance variable in a high security setting.

See Also:
Constant Field Values

ALL_F

public static final int ALL_F
See Also:
Constant Field Values

FALSE_F

public static final int FALSE_F
See Also:
Constant Field Values

NIL_F

public static final int NIL_F
This flag is a bit funny. It's used to denote that this value is nil. It's a bit counterintuitive for a Java programmer to not use subclassing to handle this case, since we have a RubyNil subclass anyway. Well, the reason for it being a flag is that the isNil() method is called extremely often. So often that it gives a good speed boost to make it monomorphic and final. It turns out using a flag for this actually gives us better performance than having a polymorphic isNil() method.

See Also:
Constant Field Values

FROZEN_F

public static final int FROZEN_F
See Also:
Constant Field Values

TAINTED_F

public static final int TAINTED_F
See Also:
Constant Field Values

UNTRUSTED_F

public static final int UNTRUSTED_F
See Also:
Constant Field Values

FL_USHIFT

public static final int FL_USHIFT
See Also:
Constant Field Values

USER0_F

public static final int USER0_F
See Also:
Constant Field Values

USER1_F

public static final int USER1_F
See Also:
Constant Field Values

USER2_F

public static final int USER2_F
See Also:
Constant Field Values

USER3_F

public static final int USER3_F
See Also:
Constant Field Values

USER4_F

public static final int USER4_F
See Also:
Constant Field Values

USER5_F

public static final int USER5_F
See Also:
Constant Field Values

USER6_F

public static final int USER6_F
See Also:
Constant Field Values

USER7_F

public static final int USER7_F
See Also:
Constant Field Values

USER8_F

public static final int USER8_F
See Also:
Constant Field Values

COMPARE_BY_IDENTITY_F

public static final int COMPARE_BY_IDENTITY_F
See Also:
Constant Field Values

NEVER

public static final IRubyObject NEVER
A value that is used as a null sentinel in among other places the RubyArray implementation. It will cause large problems to call any methods on this object.


UNDEF

public static final IRubyObject UNDEF
A value that specifies an undefined value. This value is used as a sentinel for undefined constant values, and other places where neither null nor NEVER makes sense.


BASICOBJECT_ALLOCATOR

public static final ObjectAllocator BASICOBJECT_ALLOCATOR
Default allocator instance for all Ruby objects. The only reason to not use this allocator is if you actually need to have all instances of something be a subclass of RubyObject.

See Also:
ObjectAllocator
Constructor Detail

RubyBasicObject

public RubyBasicObject(Ruby runtime,
                       RubyClass metaClass)
Standard path for object creation. Objects are entered into ObjectSpace only if ObjectSpace is enabled.


RubyBasicObject

public RubyBasicObject(RubyClass metaClass)
Path for objects that don't taint and don't enter objectspace.


RubyBasicObject

protected RubyBasicObject(Ruby runtime,
                          RubyClass metaClass,
                          boolean useObjectSpace,
                          boolean canBeTainted)
Path for objects who want to decide whether they don't want to be in ObjectSpace even when it is on. (notably used by objects being considered immediate, they'll always pass false here)


RubyBasicObject

protected RubyBasicObject(Ruby runtime,
                          RubyClass metaClass,
                          boolean useObjectSpace)
Method Detail

createBasicObjectClass

public static RubyClass createBasicObjectClass(Ruby runtime,
                                               RubyClass objectClass)
Will create the Ruby class Object in the runtime specified. This method needs to take the actual class as an argument because of the Object class' central part in runtime initialization.


initialize

public IRubyObject initialize()

initialize19

public IRubyObject initialize19()

initialize19

public IRubyObject initialize19(IRubyObject arg0)

initialize19

public IRubyObject initialize19(IRubyObject arg0,
                                IRubyObject arg1)

initialize19

public IRubyObject initialize19(IRubyObject arg0,
                                IRubyObject arg1,
                                IRubyObject arg2)

initialize19

public IRubyObject initialize19(IRubyObject[] args)

taint

protected void taint(Ruby runtime)

testFrozen

protected final void testFrozen(java.lang.String message)
rb_frozen_class_p Helper to test whether this object is frozen, and if it is will throw an exception based on the message.


testFrozen

protected final void testFrozen()
rb_frozen_class_p Helper to test whether this object is frozen, and if it is will throw an exception based on the message.


setFlag

public final void setFlag(int flag,
                          boolean set)
Sets or unsets a flag on this object. The only flags that are guaranteed to be valid to use as the first argument is:

Parameters:
flag - the actual flag to set or unset.
set - if true, the flag will be set, if false, the flag will be unset.

getFlag

public final boolean getFlag(int flag)
Get the value of a custom flag on this object. The only guaranteed flags that can be sent in to this method is:

Parameters:
flag - the flag to get
Returns:
true if the flag is set, false otherwise

callSuper

@Deprecated
public IRubyObject callSuper(ThreadContext context,
                                        IRubyObject[] args,
                                        Block block)
Deprecated. 

See org.jruby.javasupport.util.RuntimeHelpers#invokeSuper

Specified by:
callSuper in interface IRubyObject

checkCallMethod

public final IRubyObject checkCallMethod(ThreadContext context,
                                         java.lang.String name)
Will invoke a named method with no arguments and no block if that method or a custom method missing exists. Otherwise returns null. 1.9: rb_check_funcall

Specified by:
checkCallMethod in interface IRubyObject

callMethod

public final IRubyObject callMethod(ThreadContext context,
                                    java.lang.String name)
Will invoke a named method with no arguments and no block.

Specified by:
callMethod in interface IRubyObject

callMethod

public final IRubyObject callMethod(ThreadContext context,
                                    java.lang.String name,
                                    IRubyObject arg)
Will invoke a named method with one argument and no block with functional invocation.

Specified by:
callMethod in interface IRubyObject

callMethod

public final IRubyObject callMethod(ThreadContext context,
                                    java.lang.String name,
                                    IRubyObject[] args)
Will invoke a named method with the supplied arguments and no block with functional invocation.

Specified by:
callMethod in interface IRubyObject

callMethod

public final IRubyObject callMethod(java.lang.String name,
                                    IRubyObject... args)

callMethod

public final IRubyObject callMethod(java.lang.String name)

callMethod

public final IRubyObject callMethod(ThreadContext context,
                                    java.lang.String name,
                                    IRubyObject[] args,
                                    Block block)
Will invoke a named method with the supplied arguments and supplied block with functional invocation.

Specified by:
callMethod in interface IRubyObject

callMethod

@Deprecated
public final IRubyObject callMethod(ThreadContext context,
                                               int methodIndex,
                                               java.lang.String name)
Deprecated. 

Will invoke an indexed method with the no arguments and no block.

Specified by:
callMethod in interface IRubyObject

callMethod

@Deprecated
public final IRubyObject callMethod(ThreadContext context,
                                               int methodIndex,
                                               java.lang.String name,
                                               IRubyObject arg)
Deprecated. 

Will invoke an indexed method with the one argument and no block with a functional invocation.

Specified by:
callMethod in interface IRubyObject

isNil

public final boolean isNil()
Does this object represent nil? See the docs for the NIL_F flag for more information.

Specified by:
isNil in interface IRubyObject
Returns:
boolean

isTrue

public final boolean isTrue()
Is this value a true value or not? Based on the FALSE_F flag.

Specified by:
isTrue in interface IRubyObject
Returns:

isFalse

public final boolean isFalse()
Is this value a false value or not? Based on the FALSE_F flag.


isTaint

public boolean isTaint()
Gets the taint. Shortcut for getFlag(TAINTED_F).

Specified by:
isTaint in interface IRubyObject
Returns:
true if this object is tainted

setTaint

public void setTaint(boolean taint)
Sets the taint flag. Shortcut for setFlag(TAINTED_F, taint)

Specified by:
setTaint in interface IRubyObject
Parameters:
taint - should this object be tainted or not?

infectBy

public IRubyObject infectBy(IRubyObject obj)
OBJ_INFECT Infects this object with traits from the argument obj. In real terms this currently means that if obj is tainted, this object will get tainted too. It's possible to hijack this method to do other infections if that would be interesting.

Specified by:
infectBy in interface IRubyObject
Returns:

isFrozen

public boolean isFrozen()
Is this value frozen or not? Shortcut for doing getFlag(FROZEN_F).

Specified by:
isFrozen in interface IRubyObject
Returns:
true if this object is frozen, false otherwise

setFrozen

public void setFrozen(boolean frozen)
Sets whether this object is frozen or not. Shortcut for doing setFlag(FROZEN_F, frozen).

Specified by:
setFrozen in interface IRubyObject
Parameters:
frozen - should this object be frozen?

isUntrusted

public boolean isUntrusted()
Is this value untrusted or not? Shortcut for doing getFlag(UNTRUSTED_F).

Specified by:
isUntrusted in interface IRubyObject
Returns:
true if this object is frozen, false otherwise

setUntrusted

public void setUntrusted(boolean untrusted)
Sets whether this object is frozen or not. Shortcut for doing setFlag(FROZEN_F, frozen).

Specified by:
setUntrusted in interface IRubyObject
Parameters:
frozen - should this object be frozen?

isImmediate

public boolean isImmediate()
Is object immediate (def: Fixnum, Symbol, true, false, nil?).

Specified by:
isImmediate in interface IRubyObject
Returns:

getMetaClass

public final RubyClass getMetaClass()
if exist return the meta-class else return the type of the object.

Specified by:
getMetaClass in interface IRubyObject
Returns:

getSingletonClass

public RubyClass getSingletonClass()
rb_singleton_class Note: this method is specialized for RubyFixnum, RubySymbol, RubyNil and RubyBoolean Will either return the existing singleton class for this object, or create a new one and return that.

Specified by:
getSingletonClass in interface IRubyObject
Returns:
RubyClass

makeMetaClass

public RubyClass makeMetaClass(RubyClass superClass)
rb_make_metaclass Will create a new meta class, insert this in the chain of classes for this specific object, and return the generated meta class.


setMetaClass

public void setMetaClass(RubyClass metaClass)
Makes it possible to change the metaclass of an object. In practice, this is a simple version of Smalltalks Become, except that it doesn't work when we're dealing with subclasses. In practice it's used to change the singleton/meta class used, without changing the "real" inheritance chain.


getType

public RubyClass getType()
Description copied from interface: IRubyObject
RubyMethod getType.

Specified by:
getType in interface IRubyObject
Returns:
RubyClass
See Also:
IRubyObject.getType()

respondsTo

public final boolean respondsTo(java.lang.String name)
Does this object respond to the specified message? Uses a shortcut if it can be proved that respond_to? haven't been overridden.

Specified by:
respondsTo in interface IRubyObject
Returns:
boolean

respondsToMissing

public final boolean respondsToMissing(java.lang.String name)
Does this object respond to the specified message via "method_missing?"

Specified by:
respondsToMissing in interface IRubyObject
Returns:
boolean

respondsToMissing

public final boolean respondsToMissing(java.lang.String name,
                                       boolean priv)
Does this object respond to the specified message via "method_missing?"

Specified by:
respondsToMissing in interface IRubyObject
Returns:
boolean

getRuntime

public final Ruby getRuntime()
Will return the runtime that this object is associated with.

Specified by:
getRuntime in interface IRubyObject
Returns:
current runtime

getJavaClass

public java.lang.Class getJavaClass()
Will return the Java interface that most closely can represent this object, when working through JAva integration translations.

Specified by:
getJavaClass in interface IRubyObject
Returns:
Class

asJavaString

public java.lang.String asJavaString()
rb_to_id Will try to convert this object to a String using the Ruby "to_str" if the object isn't already a String. If this still doesn't work, will throw a Ruby TypeError.

Specified by:
asJavaString in interface IRubyObject
Returns:
String the symbol name

asString

public RubyString asString()
rb_obj_as_string First converts this object into a String using the "to_s" method, infects it with the current taint and returns it. If to_s doesn't return a Ruby String, anyToString() is used instead.

Specified by:
asString in interface IRubyObject
Returns:

convertToArray

public RubyArray convertToArray()
Tries to convert this object to a Ruby Array using the "to_ary" method.

Specified by:
convertToArray in interface IRubyObject
Returns:

convertToHash

public RubyHash convertToHash()
Tries to convert this object to a Ruby Hash using the "to_hash" method.

Specified by:
convertToHash in interface IRubyObject
Returns:

convertToFloat

public RubyFloat convertToFloat()
Tries to convert this object to a Ruby Float using the "to_f" method.

Specified by:
convertToFloat in interface IRubyObject
Returns:

convertToInteger

public RubyInteger convertToInteger()
Tries to convert this object to a Ruby Integer using the "to_int" method.

Specified by:
convertToInteger in interface IRubyObject
Returns:

convertToInteger

@Deprecated
public RubyInteger convertToInteger(int methodIndex,
                                               java.lang.String convertMethod)
Deprecated. 

Specified by:
convertToInteger in interface IRubyObject
Returns:

convertToInteger

public RubyInteger convertToInteger(java.lang.String convertMethod)
Tries to convert this object to a Ruby Integer using the supplied conversion method.

Specified by:
convertToInteger in interface IRubyObject
Returns:

convertToString

public RubyString convertToString()
Tries to convert this object to a Ruby String using the "to_str" method.

Specified by:
convertToString in interface IRubyObject
Returns:

anyToString

public IRubyObject anyToString()
Internal method that helps to convert any object into the format of a class name and a hex string inside of #<>.

Specified by:
anyToString in interface IRubyObject
Returns:

checkStringType

public IRubyObject checkStringType()
rb_check_string_type Tries to return a coerced string representation of this object, using "to_str". If that returns something other than a String or nil, an empty String will be returned.

Specified by:
checkStringType in interface IRubyObject
Returns:

checkStringType19

public IRubyObject checkStringType19()
rb_check_string_type Tries to return a coerced string representation of this object, using "to_str". If that returns something other than a String or nil, an empty String will be returned.

Specified by:
checkStringType19 in interface IRubyObject
Returns:

checkArrayType

public IRubyObject checkArrayType()
rb_check_array_type Returns the result of trying to convert this object to an Array with "to_ary".

Specified by:
checkArrayType in interface IRubyObject
Returns:

toJava

public java.lang.Object toJava(java.lang.Class target)
Description copied from interface: IRubyObject
Convert the object to the specified Java class, if possible.

Specified by:
toJava in interface IRubyObject
Parameters:
target - The target type to which the object should be converted.
See Also:
IRubyObject.toJava

dup

public IRubyObject dup()
Description copied from interface: IRubyObject
RubyMethod dup.

Specified by:
dup in interface IRubyObject
Returns:

copySpecialInstanceVariables

public void copySpecialInstanceVariables(IRubyObject clone)
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 interface IRubyObject

rbClone

public IRubyObject rbClone()
Description copied from interface: IRubyObject
RubyMethod rbClone.

Specified by:
rbClone in interface IRubyObject
Returns:
IRubyObject

getSingletonClassClone

protected RubyClass getSingletonClassClone()
rb_singleton_class_clone Will make sure that if the current objects class is a singleton, it will get cloned.

Returns:
either a real class, or a clone of the current singleton class

isModule

public boolean isModule()
Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.

Specified by:
isModule in interface IRubyObject
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

public boolean isClass()
Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.

Specified by:
isClass in interface IRubyObject
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

public void dataWrapStruct(java.lang.Object obj)
Description copied from interface: IRubyObject
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.

Specified by:
dataWrapStruct in interface IRubyObject
Parameters:
obj - the object to wrap
See Also:
org.jruby.runtime.builtin.IRubyObject#dataWrapStruct()

dataGetStruct

public java.lang.Object dataGetStruct()
Description copied from interface: IRubyObject
Our version of Data_Get_Struct. Returns a wrapped data value if there is one, otherwise returns null.

Specified by:
dataGetStruct in interface IRubyObject
Returns:
the object wrapped.
See Also:
IRubyObject.dataGetStruct()

dataGetStructChecked

public java.lang.Object dataGetStructChecked()
Specified by:
dataGetStructChecked in interface IRubyObject

id

public IRubyObject id()
rb_obj_id Return the internal id of an object.

Specified by:
id in interface IRubyObject
Returns:

getObjectId

protected long getObjectId()
The logic here is to use the special objectId accessor slot from the parent as a lazy store for an object ID. IDs are generated atomically, in serial, and guaranteed unique for up to 2^63 objects. The special objectId slot is managed separately from the "normal" vars so it does not marshal, clone/dup, or refuse to be initially set when the


initObjectId

protected long initObjectId(RubyClass.VariableAccessor objectIdAccessor)
We lazily stand up the object ID since it forces us to stand up per-object state for a given object. We also check for ObjectSpace here, and normally we do not register a given object ID into ObjectSpace due to the high cost associated with constructing the related weakref. Most uses of id/object_id will only ever need it to be a unique identifier, and the id2ref behavior provided by ObjectSpace is considered internal and not generally supported.

Parameters:
objectIdAccessor - The variable accessor to use for storing the generated object ID
Returns:
The generated object ID

inspect

public IRubyObject inspect()
rb_obj_inspect call-seq: obj.inspect => string Returns a string containing a human-readable representation of obj. If not overridden, uses the to_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 interface IRubyObject
Returns:
String

hashyInspect

public IRubyObject hashyInspect()

inspectHashCode

protected int inspectHashCode()
For most objects, the hash used in the default #inspect is just the identity hashcode of the actual object. See org.jruby.java.proxies.JavaProxy for a divergent case.

Returns:
The identity hashcode of this object

op_not

public IRubyObject op_not(ThreadContext context)

op_not_equal

public IRubyObject op_not_equal(ThreadContext context,
                                IRubyObject other)

compareTo

public int compareTo(IRubyObject other)
Specified by:
compareTo in interface java.lang.Comparable<IRubyObject>

op_equal

public IRubyObject op_equal(ThreadContext context,
                            IRubyObject obj)
Specified by:
op_equal in interface IRubyObject

op_equal_19

public IRubyObject op_equal_19(ThreadContext context,
                               IRubyObject obj)
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


op_eqq

public IRubyObject op_eqq(ThreadContext context,
                          IRubyObject other)
Specified by:
op_eqq in interface IRubyObject

equal_p19

public IRubyObject equal_p19(ThreadContext context,
                             IRubyObject other)

equalInternal

protected static boolean equalInternal(ThreadContext context,
                                       IRubyObject that,
                                       IRubyObject other)
Helper method for checking equality, first using Java identity equality, and then calling the "==" method.


eql

public boolean eql(IRubyObject other)
method used for Hash key comparison (specialized for String, Symbol and Fixnum) Will by default just call the Ruby method "eql?"

Specified by:
eql in interface IRubyObject

addFinalizer

public void addFinalizer(IRubyObject f)
Adds the specified object as a finalizer for this object.

Specified by:
addFinalizer in interface IRubyObject

removeFinalizers

public void removeFinalizers()
Remove all the finalizers for this object.

Specified by:
removeFinalizers in interface IRubyObject

getVariable

public java.lang.Object getVariable(int index)
Specified by:
getVariable in interface IRubyObject

setVariable

public void setVariable(int index,
                        java.lang.Object value)
Specified by:
setVariable in interface IRubyObject

hasVariables

public boolean hasVariables()
Returns true if object has any variables, defined as:

Specified by:
hasVariables in interface IRubyObject
Returns:
true if object has any variables, else false

getVariableCount

@Deprecated
public int getVariableCount()
Deprecated. 

Returns the amount of instance variables, class variables, constants and internal variables this object has.

Specified by:
getVariableCount in interface IRubyObject
Returns:
the count of all variables (ivar/cvar/constant/internal)

getVariableList

public java.util.List<Variable<java.lang.Object>> getVariableList()
Gets a list of all variables in this object.

Specified by:
getVariableList in interface IRubyObject
Returns:
a list of all variables (ivar/cvar/constant/internal)

getVariableNameList

public java.util.List<java.lang.String> getVariableNameList()
Gets a name list of all variables in this object.

Specified by:
getVariableNameList in interface IRubyObject
Returns:
a list of all variable names (ivar/cvar/constant/internal)

variableTableContains

protected boolean variableTableContains(java.lang.String name)
Checks if the variable table contains a variable of the specified name.


variableTableFastContains

protected boolean variableTableFastContains(java.lang.String internedName)
Checks if the variable table contains the the variable of the specified name, where the precondition is that the name must be an interned Java String.


variableTableFetch

protected java.lang.Object variableTableFetch(java.lang.String name)
Fetch an object from the variable table based on the name.

Returns:
the object or null if not found

variableTableFastFetch

protected java.lang.Object variableTableFastFetch(java.lang.String internedName)
Fetch an object from the variable table based on the name, where the name must be an interned Java String.

Returns:
the object or null if not found

variableTableStore

protected java.lang.Object variableTableStore(java.lang.String name,
                                              java.lang.Object value)
Store a value in the variable store under the specific name.


variableTableFastStore

protected java.lang.Object variableTableFastStore(java.lang.String internedName,
                                                  java.lang.Object value)
Will store the value under the specified name, where the name needs to be an interned Java String.


variableTableRemove

protected java.lang.Object variableTableRemove(java.lang.String name)
Removes the entry with the specified name from the variable table, and returning the removed value.


variableTableSync

protected void variableTableSync(java.util.List<Variable<java.lang.Object>> vars)
Synchronize the variable table with the argument. In real terms this means copy all entries into a newly allocated table.


getInternalVariables

public InternalVariables getInternalVariables()
Dummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.

Specified by:
getInternalVariables in interface IRubyObject

hasInternalVariable

public boolean hasInternalVariable(java.lang.String name)
Description copied from interface: InternalVariables
Returns true if object has the named internal variable. Use only for internal variables (not ivar/cvar/constant).

Specified by:
hasInternalVariable in interface InternalVariables
Parameters:
name - the name of an internal variable
Returns:
true if object has the named internal variable.
See Also:
InternalVariables.hasInternalVariable(java.lang.String)

fastHasInternalVariable

public boolean fastHasInternalVariable(java.lang.String internedName)
Description copied from interface: InternalVariables
Returns true if object has the named internal variable. Use only for internal variables (not ivar/cvar/constant). The supplied name must have been previously interned.

Specified by:
fastHasInternalVariable in interface InternalVariables
Parameters:
internedName - the interned name of an internal variable
Returns:
true if object has the named internal variable, else false
See Also:
InternalVariables.fastHasInternalVariable(java.lang.String)

getInternalVariable

public java.lang.Object getInternalVariable(java.lang.String name)
Description copied from interface: InternalVariables
Returns the named internal variable if present, else null. Use only for internal variables (not ivar/cvar/constant).

Specified by:
getInternalVariable in interface InternalVariables
Parameters:
name - the name of an internal variable
Returns:
the named internal variable if present, else null
See Also:
InternalVariables.getInternalVariable(java.lang.String)

fastGetInternalVariable

public java.lang.Object fastGetInternalVariable(java.lang.String internedName)
Description copied from interface: InternalVariables
Returns the named internal variable if present, else null. Use only for internal variables (not ivar/cvar/constant). The supplied name must have been previously interned.

Specified by:
fastGetInternalVariable in interface InternalVariables
Parameters:
internedName - the interned name of an internal variable
Returns:
he named internal variable if present, else null
See Also:
InternalVariables.fastGetInternalVariable(java.lang.String)

setInternalVariable

public void setInternalVariable(java.lang.String name,
                                java.lang.Object value)
Description copied from interface: InternalVariables
Sets the named internal variable to the specified value. Use only for internal variables (not ivar/cvar/constant).

Specified by:
setInternalVariable in interface InternalVariables
Parameters:
name - the name of an internal variable
value - the value to be set
See Also:
InternalVariables.setInternalVariable(java.lang.String, java.lang.Object)

fastSetInternalVariable

public void fastSetInternalVariable(java.lang.String internedName,
                                    java.lang.Object value)
Description copied from interface: InternalVariables
Sets the named internal variable to the specified value. Use only for internal variables (not ivar/cvar/constant). The supplied name must have been previously interned.

Specified by:
fastSetInternalVariable in interface InternalVariables
Parameters:
internedName - the interned name of an internal variable
value - the value to be set
See Also:
InternalVariables.fastSetInternalVariable(java.lang.String, java.lang.Object)

removeInternalVariable

public java.lang.Object removeInternalVariable(java.lang.String name)
Description copied from interface: InternalVariables
Removes the named internal variable, if present, returning its value. Use only for internal variables (not ivar/cvar/constant).

Specified by:
removeInternalVariable in interface InternalVariables
Parameters:
name - the name of the variable to remove
Returns:
the value of the remove variable, if present; else null
See Also:
InternalVariables.removeInternalVariable(java.lang.String)

syncVariables

@Deprecated
public void syncVariables(java.util.List<Variable<java.lang.Object>> variables)
Deprecated. 

Sync one variable table with another - this is used to make rbClone work correctly.

Specified by:
syncVariables in interface IRubyObject
Parameters:
variables - the variables to be set for object

syncVariables

public void syncVariables(IRubyObject other)
Sync one this object's variables with other's - this is used to make rbClone work correctly.

Specified by:
syncVariables in interface IRubyObject
Parameters:
other - the source object containing the variables to sync

getInstanceVariables

public InstanceVariables getInstanceVariables()
Dummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.

Specified by:
getInstanceVariables in interface IRubyObject

hasInstanceVariable

public boolean hasInstanceVariable(java.lang.String name)
Description copied from interface: InstanceVariables
Returns true if object has the named instance variable.

Specified by:
hasInstanceVariable in interface InstanceVariables
Parameters:
name - the name of an instance variable
Returns:
true if object has the named instance variable.
See Also:
InstanceVariables.hasInstanceVariable(java.lang.String)

fastHasInstanceVariable

public boolean fastHasInstanceVariable(java.lang.String internedName)
Description copied from interface: InstanceVariables
Returns true if object has the named instance variable. The supplied name must have been previously interned.

Specified by:
fastHasInstanceVariable in interface InstanceVariables
Parameters:
internedName - the interned name of an instance variable
Returns:
true if object has the named instance variable, else false
See Also:
InstanceVariables.fastHasInstanceVariable(java.lang.String)

getInstanceVariable

public IRubyObject getInstanceVariable(java.lang.String name)
Description copied from interface: InstanceVariables
Returns the named instance variable if present, else null.

Specified by:
getInstanceVariable in interface InstanceVariables
Parameters:
name - the name of an instance variable
Returns:
the named instance variable if present, else null
See Also:
InstanceVariables.getInstanceVariable(java.lang.String)

fastGetInstanceVariable

public IRubyObject fastGetInstanceVariable(java.lang.String internedName)
Description copied from interface: InstanceVariables
Returns the named instance variable if present, else null. The supplied name must have been previously interned.

Specified by:
fastGetInstanceVariable in interface InstanceVariables
Parameters:
internedName - the interned name of an instance variable
Returns:
he named instance variable if present, else null
See Also:
InstanceVariables.fastGetInstanceVariable(java.lang.String)

setInstanceVariable

public IRubyObject setInstanceVariable(java.lang.String name,
                                       IRubyObject value)
rb_iv_set / rb_ivar_set

Specified by:
setInstanceVariable in interface InstanceVariables
Parameters:
name - the name of an instance variable
value - the value to be set
See Also:
InstanceVariables.setInstanceVariable(java.lang.String, org.jruby.runtime.builtin.IRubyObject)

fastSetInstanceVariable

public IRubyObject fastSetInstanceVariable(java.lang.String internedName,
                                           IRubyObject value)
Description copied from interface: InstanceVariables
Sets the named instance variable to the specified value. The supplied name must have been previously interned.

Specified by:
fastSetInstanceVariable in interface InstanceVariables
Parameters:
internedName - the interned name of an instance variable
value - the value to be set
See Also:
InstanceVariables.fastSetInstanceVariable(java.lang.String, org.jruby.runtime.builtin.IRubyObject)

removeInstanceVariable

public IRubyObject removeInstanceVariable(java.lang.String name)
Description copied from interface: InstanceVariables
Removes the named instance variable, if present, returning its value.

Specified by:
removeInstanceVariable in interface InstanceVariables
Parameters:
name - the name of the variable to remove
Returns:
the value of the remove variable, if present; else null
See Also:
InstanceVariables.removeInstanceVariable(java.lang.String)

getInstanceVariableList

public java.util.List<Variable<IRubyObject>> getInstanceVariableList()
Gets a list of all variables in this object.

Specified by:
getInstanceVariableList in interface InstanceVariables
Returns:
instance variables

getInstanceVariableNameList

public java.util.List<java.lang.String> getInstanceVariableNameList()
Gets a name list of all variables in this object.

Specified by:
getInstanceVariableNameList in interface InstanceVariables
Returns:
instance variable names

copyInstanceVariablesInto

public void copyInstanceVariablesInto(InstanceVariables other)
Description copied from interface: InstanceVariables
Copies all instance variables from the given object into the receiver

Specified by:
copyInstanceVariablesInto in interface InstanceVariables
See Also:
InstanceVariables.getInstanceVariableNameList()

ensureInstanceVariablesSettable

protected final void ensureInstanceVariablesSettable()
Makes sure that instance variables can be set on this object, including information about whether this object is frozen, or tainted. Will throw a suitable exception in that case.


getNativeTypeIndex

public int getNativeTypeIndex()
Description copied from interface: CoreObjectType
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.

Specified by:
getNativeTypeIndex in interface CoreObjectType
Returns:
the ClassIndex of the native type this object was constructed from

isBuiltin

public boolean isBuiltin(java.lang.String methodName)
A method to determine whether the method named by methodName is a builtin method. This means a method with a JRubyMethod annotation written in Java.

Parameters:
methodName - to look for.
Returns:
true if so

singleton_method_added19

public static IRubyObject singleton_method_added19(ThreadContext context,
                                                   IRubyObject recv,
                                                   IRubyObject symbolId,
                                                   Block block)

singleton_method_removed19

public static IRubyObject singleton_method_removed19(ThreadContext context,
                                                     IRubyObject recv,
                                                     IRubyObject symbolId,
                                                     Block block)

singleton_method_undefined19

public static IRubyObject singleton_method_undefined19(ThreadContext context,
                                                       IRubyObject recv,
                                                       IRubyObject symbolId,
                                                       Block block)

method_missing19

public static IRubyObject method_missing19(ThreadContext context,
                                           IRubyObject recv,
                                           IRubyObject[] args,
                                           Block block)

send19

public IRubyObject send19(ThreadContext context,
                          Block block)

send19

public IRubyObject send19(ThreadContext context,
                          IRubyObject arg0,
                          Block block)

send19

public IRubyObject send19(ThreadContext context,
                          IRubyObject arg0,
                          IRubyObject arg1,
                          Block block)

send19

public IRubyObject send19(ThreadContext context,
                          IRubyObject arg0,
                          IRubyObject arg1,
                          IRubyObject arg2,
                          Block block)

send19

public IRubyObject send19(ThreadContext context,
                          IRubyObject[] args,
                          Block block)

instance_eval19

public IRubyObject instance_eval19(ThreadContext context,
                                   Block block)

instance_eval19

public IRubyObject instance_eval19(ThreadContext context,
                                   IRubyObject arg0,
                                   Block block)

instance_eval19

public IRubyObject instance_eval19(ThreadContext context,
                                   IRubyObject arg0,
                                   IRubyObject arg1,
                                   Block block)

instance_eval19

public IRubyObject instance_eval19(ThreadContext context,
                                   IRubyObject arg0,
                                   IRubyObject arg1,
                                   IRubyObject arg2,
                                   Block block)

instance_exec19

public IRubyObject instance_exec19(ThreadContext context,
                                   IRubyObject[] args,
                                   Block block)

yieldUnder

protected IRubyObject yieldUnder(ThreadContext context,
                                 RubyModule under,
                                 IRubyObject[] args,
                                 Block block)
Will yield to the specific block changing the self to be the current object instead of the self that is part of the frame saved in the block frame. This method is the basis for the Ruby instance_eval and module_eval methods. The arguments sent in to it in the args array will be yielded to the block. This makes it possible to emulate both instance_eval and instance_exec with this implementation.


yieldUnder

protected IRubyObject yieldUnder(ThreadContext context,
                                 RubyModule under,
                                 Block block)
Will yield to the specific block changing the self to be the current object instead of the self that is part of the frame saved in the block frame. This method is the basis for the Ruby instance_eval and module_eval methods. The arguments sent in to it in the args array will be yielded to the block. This makes it possible to emulate both instance_eval and instance_exec with this implementation.


specificEval

public IRubyObject specificEval(ThreadContext context,
                                RubyModule mod,
                                Block block)
specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.


specificEval

public IRubyObject specificEval(ThreadContext context,
                                RubyModule mod,
                                IRubyObject arg,
                                Block block)
specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.


specificEval

public IRubyObject specificEval(ThreadContext context,
                                RubyModule mod,
                                IRubyObject arg0,
                                IRubyObject arg1,
                                Block block)
specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.


specificEval

public IRubyObject specificEval(ThreadContext context,
                                RubyModule mod,
                                IRubyObject arg0,
                                IRubyObject arg1,
                                IRubyObject arg2,
                                Block block)
specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments. If a block is given, this will be yielded in the specific context of this object. If no block is given then a String-like object needs to be the first argument, and this string will be evaluated. Second and third arguments in the args-array is optional, but can contain the filename and line of the string under evaluation.


getInstanceEvalClass

protected RubyModule getInstanceEvalClass()

evalUnder

public IRubyObject evalUnder(ThreadContext context,
                             RubyModule under,
                             RubyString src,
                             java.lang.String file,
                             int line)
Evaluates the string src with self set to the current object, using the module under as the context.


equal_p

public IRubyObject equal_p(ThreadContext context,
                           IRubyObject obj)
rb_obj_equal Will use Java identity equality.


eql_p

public IRubyObject eql_p(IRubyObject obj)
rb_obj_equal Just like "==" and "equal?", "eql?" will use identity equality for Object.


op_cmp

public IRubyObject op_cmp(ThreadContext context,
                          IRubyObject other)

initialize_copy

public IRubyObject initialize_copy(IRubyObject original)
rb_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.


checkFrozen

protected void checkFrozen()
The actual method that checks frozen with the default frozen message from MRI. If possible, call this instead of testFrozen(java.lang.String).


respond_to_p

public RubyBoolean respond_to_p(IRubyObject mname)
obj_respond_to respond_to?( aSymbol, includePriv=false ) -> true or false Returns true if this object responds to the given method. Private methods are included in the search only if the optional second parameter evaluates to true.

Returns:
true if this responds to the given method !!! For some reason MRI shows the arity of respond_to? as -1, when it should be -2; that's why this is rest instead of required, optional = 1 Going back to splitting according to method arity. MRI is wrong about most of these anyway, and since we have arity splitting in both the compiler and the interpreter, the performance benefit is important for this method.

respond_to_p19

public IRubyObject respond_to_p19(IRubyObject mname)

respond_to_p

public RubyBoolean respond_to_p(IRubyObject mname,
                                IRubyObject includePrivate)
obj_respond_to respond_to?( aSymbol, includePriv=false ) -> true or false Returns true if this object responds to the given method. Private methods are included in the search only if the optional second parameter evaluates to true.

Returns:
true if this responds to the given method !!! For some reason MRI shows the arity of respond_to? as -1, when it should be -2; that's why this is rest instead of required, optional = 1 Going back to splitting according to method arity. MRI is wrong about most of these anyway, and since we have arity splitting in both the compiler and the interpreter, the performance benefit is important for this method.

respond_to_p19

public IRubyObject respond_to_p19(IRubyObject mname,
                                  IRubyObject includePrivate)

id_deprecated

public IRubyObject id_deprecated()
rb_obj_id_obsolete Old id version. This one is bound to the "id" name and will emit a deprecation warning.


hash

public RubyFixnum hash()
rb_obj_id 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.


type

public RubyClass type()
rb_obj_class Returns the real class of this object, excluding any singleton/meta class in the inheritance chain.


type_deprecated

public RubyClass type_deprecated()
rb_obj_type The deprecated version of type, that emits a deprecation warning.


display

public IRubyObject display(ThreadContext context,
                           IRubyObject[] args)
rb_obj_display call-seq: obj.display(port=$>) => nil Prints obj on the given port (default $>). Equivalent to: def display(port=$>) port.write self end For example: 1.display "cat".display [ 4, 5, 6 ].display puts produces: 1cat456


tainted_p

public RubyBoolean tainted_p(ThreadContext context)
rb_obj_tainted call-seq: obj.tainted? => true or false Returns true if the object is tainted.


taint

public IRubyObject taint(ThreadContext context)
rb_obj_taint call-seq: obj.taint -> obj Marks obj as tainted---if the $SAFE level is set appropriately, many method calls which might alter the running programs environment will refuse to accept tainted strings.


untaint

public IRubyObject untaint(ThreadContext context)
rb_obj_untaint call-seq: obj.untaint => obj Removes the taint from obj. Only callable in if more secure than 3.


freeze

public IRubyObject freeze(ThreadContext context)
rb_obj_freeze call-seq: obj.freeze => obj Prevents further modifications to obj. A TypeError will be raised if modification is attempted. There is no way to unfreeze a frozen object. See also Object#frozen?. a = [ "a", "b", "c" ] a.freeze a << "z" produces: prog.rb:3:in `<<': can't modify frozen array (TypeError) from prog.rb:3


frozen_p

public RubyBoolean frozen_p(ThreadContext context)
rb_obj_frozen_p call-seq: obj.frozen? => true or false Returns the freeze status of obj. a = [ "a", "b", "c" ] a.freeze #=> ["a", "b", "c"] a.frozen? #=> true


untrusted_p

public RubyBoolean untrusted_p(ThreadContext context)
rb_obj_untrusted call-seq: obj.untrusted? => true or false Returns true if the object is untrusted.


untrust

public IRubyObject untrust(ThreadContext context)
rb_obj_untrust call-seq: obj.untrust -> obj Marks obj as untrusted.


trust

public IRubyObject trust(ThreadContext context)
rb_obj_trust call-seq: obj.trust => obj Removes the untrusted mark from obj.


instance_of_p

public RubyBoolean instance_of_p(ThreadContext context,
                                 IRubyObject type)
rb_obj_is_instance_of call-seq: obj.instance_of?(class) => true or false Returns true if obj is an instance of the given class. See also Object#kind_of?.


kind_of_p

public RubyBoolean kind_of_p(ThreadContext context,
                             IRubyObject type)
rb_obj_is_kind_of call-seq: obj.is_a?(class) => true or false obj.kind_of?(class) => true or false Returns true if class is the class of obj, or if class is one of the superclasses of obj or modules included in obj. module M; end class A include M end class B < A; end class C < B; end b = B.new b.instance_of? A #=> false b.instance_of? B #=> true b.instance_of? C #=> false b.instance_of? M #=> false b.kind_of? A #=> true b.kind_of? B #=> true b.kind_of? C #=> false b.kind_of? M #=> true


methods

public IRubyObject methods(ThreadContext context,
                           IRubyObject[] args)
rb_obj_methods call-seq: obj.methods => array Returns a list of the names of methods publicly accessible in obj. This will include all the methods accessible in obj's ancestors. class Klass def kMethod() end end k = Klass.new k.methods[0..9] #=> ["kMethod", "freeze", "nil?", "is_a?", "class", "instance_variable_set", "methods", "extend", "__send__", "instance_eval"] k.methods.length #=> 42


methods19

public IRubyObject methods19(ThreadContext context,
                             IRubyObject[] args)

methods

public IRubyObject methods(ThreadContext context,
                           IRubyObject[] args,
                           boolean useSymbols)

public_methods

public IRubyObject public_methods(ThreadContext context,
                                  IRubyObject[] args)
rb_obj_public_methods call-seq: obj.public_methods(all=true) => array Returns the list of public methods accessible to obj. If the all parameter is set to false, only those methods in the receiver will be listed.


public_methods19

public IRubyObject public_methods19(ThreadContext context,
                                    IRubyObject[] args)

protected_methods

public IRubyObject protected_methods(ThreadContext context,
                                     IRubyObject[] args)
rb_obj_protected_methods call-seq: obj.protected_methods(all=true) => array Returns the list of protected methods accessible to obj. If the all parameter is set to false, only those methods in the receiver will be listed. Internally this implementation uses the RubyModule.protected_instance_methods(org.jruby.runtime.builtin.IRubyObject[]) method.


protected_methods19

public IRubyObject protected_methods19(ThreadContext context,
                                       IRubyObject[] args)

private_methods

public IRubyObject private_methods(ThreadContext context,
                                   IRubyObject[] args)
rb_obj_private_methods call-seq: obj.private_methods(all=true) => array Returns the list of private methods accessible to obj. If the all parameter is set to false, only those methods in the receiver will be listed. Internally this implementation uses the RubyModule.private_instance_methods(org.jruby.runtime.builtin.IRubyObject[]) method.


private_methods19

public IRubyObject private_methods19(ThreadContext context,
                                     IRubyObject[] args)

singleton_methods

public RubyArray singleton_methods(ThreadContext context,
                                   IRubyObject[] args)
rb_obj_singleton_methods call-seq: obj.singleton_methods(all=true) => array Returns an array of the names of singleton methods for obj. If the optional all parameter is true, the list will include methods in modules included in obj. module Other def three() end end class Single def Single.four() end end a = Single.new def a.one() end class << a include Other def two() end end Single.singleton_methods #=> ["four"] a.singleton_methods(false) #=> ["two", "one"] a.singleton_methods #=> ["two", "one", "three"]


singleton_methods19

public RubyArray singleton_methods19(ThreadContext context,
                                     IRubyObject[] args)

method

public IRubyObject method(IRubyObject symbol)
rb_obj_method call-seq: obj.method(sym) => method Looks up the named method as a receiver in obj, returning a Method object (or raising NameError). The Method object acts as a closure in obj's object instance, so instance variables and the value of self remain available. class Demo def initialize(n)


method19

public IRubyObject method19(IRubyObject symbol)

to_s

public IRubyObject to_s()
rb_any_to_s call-seq: obj.to_s => string Returns a string representing obj. The default to_s prints the object's class and an encoding of the object id. As a special case, the top-level object that is the initial execution context of Ruby programs returns ``main.''


to_a

public RubyArray to_a()
rb_any_to_a call-seq: obj.to_a -> anArray Returns an array representation of obj. For objects of class Object and others that don't explicitly override the method, the return value is an array containing self. 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.


instance_eval

public IRubyObject instance_eval(ThreadContext context,
                                 Block block)
rb_obj_instance_eval call-seq: obj.instance_eval(string [, filename [, lineno]] ) => obj obj.instance_eval {| | block } => obj Evaluates a string containing Ruby source code, or the given block, within the context of the receiver (_obj_). In order to set the context, the variable +self+ is set to _obj_ while the code is executing, giving the code access to _obj_'s instance variables. In the version of instance_eval that takes a +String+, the optional second and third parameters supply a filename and starting line number that are used when reporting compilation errors. class Klass def initialize


instance_eval

public IRubyObject instance_eval(ThreadContext context,
                                 IRubyObject arg0,
                                 Block block)

instance_eval

public IRubyObject instance_eval(ThreadContext context,
                                 IRubyObject arg0,
                                 IRubyObject arg1,
                                 Block block)

instance_eval

public IRubyObject instance_eval(ThreadContext context,
                                 IRubyObject arg0,
                                 IRubyObject arg1,
                                 IRubyObject arg2,
                                 Block block)

instance_exec

public IRubyObject instance_exec(ThreadContext context,
                                 IRubyObject[] args,
                                 Block block)
rb_obj_instance_exec call-seq: obj.instance_exec(arg...) {|var...| block } => obj Executes the given block within the context of the receiver (_obj_). In order to set the context, the variable +self+ is set to _obj_ while the code is executing, giving the code access to _obj_'s instance variables. Arguments are passed as block parameters. class Klass def initialize


extend

public IRubyObject extend(IRubyObject[] args)
rb_obj_extend call-seq: obj.extend(module, ...) => obj Adds to _obj_ the instance methods from each module given as a parameter. module Mod def hello "Hello from Mod.\n" end end class Klass def hello "Hello from Klass.\n" end end k = Klass.new k.hello #=> "Hello from Klass.\n" k.extend(Mod) #=> # k.hello #=> "Hello from Mod.\n"


send

public IRubyObject send(ThreadContext context,
                        Block block)
rb_f_send send( aSymbol [, args ]* ) -> anObject Invokes the method identified by aSymbol, passing it any arguments specified. You can use __send__ if the name send clashes with an existing method in this object.
 class Klass
   def hello(*args)
     "Hello " + args.join(' ')
   end
 end

 k = Klass.new
 k.send :hello, "gentle", "readers"
 

Returns:
the result of invoking the method identified by aSymbol.

send

public IRubyObject send(ThreadContext context,
                        IRubyObject arg0,
                        Block block)

send

public IRubyObject send(ThreadContext context,
                        IRubyObject arg0,
                        IRubyObject arg1,
                        Block block)

send

public IRubyObject send(ThreadContext context,
                        IRubyObject arg0,
                        IRubyObject arg1,
                        IRubyObject arg2,
                        Block block)

send

public IRubyObject send(ThreadContext context,
                        IRubyObject[] args,
                        Block block)

nil_p

public IRubyObject nil_p(ThreadContext context)
rb_false call_seq: nil.nil? => true .nil? => false Only the object nil responds true to nil?.


op_match

public IRubyObject op_match(ThreadContext context,
                            IRubyObject arg)
rb_obj_pattern_match call-seq: obj =~ other => false Pattern Match---Overridden by descendents (notably Regexp and String) to provide meaningful pattern-match semantics.


op_match19

public IRubyObject op_match19(ThreadContext context,
                              IRubyObject arg)

op_not_match

public IRubyObject op_not_match(ThreadContext context,
                                IRubyObject arg)

instance_variable_defined_p

public IRubyObject instance_variable_defined_p(ThreadContext context,
                                               IRubyObject name)
rb_obj_ivar_defined call-seq: obj.instance_variable_defined?(symbol) => true or false Returns true if the given instance variable is defined in obj. class Fred def initialize(p1, p2)


instance_variable_get

public IRubyObject instance_variable_get(ThreadContext context,
                                         IRubyObject name)
rb_obj_ivar_get call-seq: obj.instance_variable_get(symbol) => obj Returns the value of the given instance variable, or nil if the instance variable is not set. The @ part of the variable name should be included for regular instance variables. Throws a NameError exception if the supplied symbol is not valid as an instance variable name. class Fred def initialize(p1, p2)


instance_variable_set

public IRubyObject instance_variable_set(IRubyObject name,
                                         IRubyObject value)
rb_obj_ivar_set call-seq: obj.instance_variable_set(symbol, obj) => obj Sets the instance variable names by symbol to object, thereby frustrating the efforts of the class's author to attempt to provide proper encapsulation. The variable did not have to exist prior to this call. class Fred def initialize(p1, p2)


remove_instance_variable

public IRubyObject remove_instance_variable(ThreadContext context,
                                            IRubyObject name,
                                            Block block)
rb_obj_remove_instance_variable call-seq: obj.remove_instance_variable(symbol) => obj Removes the named instance variable from obj, returning that variable's value. class Dummy attr_reader :var def initialize


instance_variables

public RubyArray instance_variables(ThreadContext context)
rb_obj_instance_variables call-seq: obj.instance_variables => array Returns an array of instance variable names for the receiver. Note that simply defining an accessor does not create the corresponding instance variable. class Fred attr_accessor :a1 def initialize


instance_variables19

public RubyArray instance_variables19(ThreadContext context)

validateInstanceVariable

protected java.lang.String validateInstanceVariable(java.lang.String name)
Checks if the name parameter represents a legal instance variable name, and otherwise throws a Ruby NameError



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