public class RubyBasicObject extends java.lang.Object implements java.lang.Cloneable, IRubyObject, java.io.Serializable, java.lang.Comparable<IRubyObject>, CoreObjectType, InstanceVariables, InternalVariables
IRubyObject
. Every Ruby object in JRuby
is represented by something that is an instance of RubyBasicObject. In
the core class implementations, this means doing a subclass
that extends RubyBasicObject. In other cases it means using a simple
RubyBasicObject instance and its data fields to store specific
information about the Ruby object.
Some care has been taken to make the implementation be as
monomorphic as possible, so that the Java Hotspot engine can
improve performance of it. That is the reason for several patterns
that might seem odd in this class.
The IRubyObject interface used to have lots of methods for
different things, but these have now mostly been refactored into
several interfaces that gives access to that specific part of the
object. This gives us the possibility to switch out that subsystem
without changing interfaces again. For example, instance variable
and internal variables are handled this way, but the implementation
in RubyObject only returns "this" in getInstanceVariables()
and
getInternalVariables()
.
Methods that are implemented here, such as "initialize" should be implemented
with care; reification of Ruby classes into Java classes can produce
conflicting method names in rare cases. See JRUBY-5906 for an example.Modifier and Type | Class and Description |
---|---|
static class |
RubyBasicObject.Finalizer
Class that keeps track of the finalizers for the object under
operation.
|
Modifier and Type | Field and Description |
---|---|
static int |
ALL_F |
static ObjectAllocator |
BASICOBJECT_ALLOCATOR
Default allocator instance for all Ruby objects.
|
static int |
COMPARE_BY_IDENTITY_F
Deprecated.
|
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
Deprecated.
|
protected int |
flags
object flags
|
static int |
FROZEN_F |
static int |
IS_OVERLAID_F
Deprecated.
|
protected RubyClass |
metaClass
The class of this object
|
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 |
REFINED_MODULE_F
Deprecated.
|
static long |
STAMP_OFFSET
offset of the varTableTamp field in RubyBasicObject
|
static int |
TAINTED_F |
static IRubyObject |
UNDEF
A value that specifies an undefined value.
|
static int |
UNTRUST_F
Deprecated.
|
static int |
USER0_F
Deprecated.
|
static int |
USER1_F
Deprecated.
|
static int |
USER2_F
Deprecated.
|
static int |
USER3_F
Deprecated.
|
static int |
USER4_F
Deprecated.
|
static int |
USER5_F
Deprecated.
|
static int |
USER6_F
Deprecated.
|
static int |
USER7_F
Deprecated.
|
static int |
USER8_F
Deprecated.
|
static int |
USER9_F
Deprecated.
|
static int |
USERA_F
Deprecated.
|
static long |
VAR_TABLE_OFFSET
offset of the varTable field in RubyBasicObject
|
java.lang.Object[] |
varTable
variable table, lazily allocated as needed (if needed)
|
int |
varTableStamp
locking stamp for Unsafe ops updating the vartable
|
NULL_ARRAY
Modifier | Constructor and Description |
---|---|
|
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)
Path for objects who want to decide whether they don't want to be in
ObjectSpace even when it is on.
|
protected |
RubyBasicObject(Ruby runtime,
RubyClass metaClass,
boolean useObjectSpace,
boolean canBeTainted)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
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(java.lang.String name,
IRubyObject arg) |
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,
JavaSites.CheckedSites sites)
Will invoke a named method with no arguments and no block if that method or a custom
method missing exists.
|
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.
|
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()
Deprecated.
|
int |
compareTo(IRubyObject other)
Compares this Ruby object with another.
|
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()
Deprecated.
|
void |
dataWrapStruct(java.lang.Object obj)
Our version of Data_Wrap_Struct.
|
RubyString |
decode(java.lang.String id)
raw (id) strings are not properly encoded but in an iso_8859_1 form.
|
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.
|
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 other)
rb_obj_equal
Will use Java identity equality.
|
IRubyObject |
equal_p19(ThreadContext context,
IRubyObject other)
Deprecated.
|
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.
|
boolean |
equals(java.lang.Object other)
This method is just a wrapper around the Ruby "==" method,
provided so that RubyObjects can be used as keys in the Java
HashMap object underlying RubyHash.
|
IRubyObject |
evalUnder(ThreadContext context,
RubyModule under,
RubyString src,
java.lang.String file,
int line,
EvalType evalType)
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)
Deprecated.
|
java.lang.Object |
fastGetInternalVariable(java.lang.String internedName)
Deprecated.
|
boolean |
fastHasInstanceVariable(java.lang.String internedName)
Deprecated.
|
boolean |
fastHasInternalVariable(java.lang.String internedName)
Deprecated.
|
IRubyObject |
fastSetInstanceVariable(java.lang.String internedName,
IRubyObject value)
Deprecated.
|
void |
fastSetInternalVariable(java.lang.String internedName,
java.lang.Object value)
Deprecated.
|
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.
|
java.lang.Object |
getFFIHandle() |
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.
|
static RubyClass |
getMetaClass(IRubyObject arg) |
ClassIndex |
getNativeClassIndex()
Return the ClassIndex for the native type this object was constructed
from.
|
java.lang.Object |
getNativeHandle()
Deprecated.
|
int |
getNativeTypeIndex()
Deprecated.
|
protected long |
getObjectId()
The logic here is to use the special objectId accessor slot from the
parent as a lazy store for an object symbol.
|
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() |
protected RubyClass |
getSingletonClassCloneAndAttach(RubyBasicObject attach)
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.
|
int |
hashCode()
Override the Object#hashCode method to make sure that the Ruby
hash is actually used as the hashcode for Ruby objects.
|
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
|
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(ThreadContext context) |
IRubyObject |
initialize19(ThreadContext context)
Deprecated.
|
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)
Deprecated.
|
IRubyObject |
instance_eval19(ThreadContext context,
IRubyObject arg0,
Block block)
Deprecated.
|
IRubyObject |
instance_eval19(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1,
Block block)
Deprecated.
|
IRubyObject |
instance_eval19(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
Block block)
Deprecated.
|
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)
Deprecated.
|
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)
Deprecated.
|
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 falsey 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 |
isSpecialConst() |
boolean |
isSpecialObject() |
boolean |
isTaint()
Gets the taint.
|
boolean |
isTrue()
Is this value a truthy value or not? Based on the
FALSE_F flag. |
boolean |
isUntrusted()
Deprecated.
|
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_missing(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block) |
static IRubyObject |
method_missing19(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
Deprecated.
|
IRubyObject |
method(IRubyObject name)
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 name)
Deprecated.
|
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)
Deprecated.
|
IRubyObject |
methods19(ThreadContext context,
IRubyObject[] args)
Deprecated.
|
IRubyObject |
nil_p(ThreadContext context)
rb_false
call_seq:
nil.nil? => true
true to nil? . |
protected static int |
nonFixnumHashCode(IRubyObject hashValue) |
protected static boolean |
OBJ_INIT_COPY(IRubyObject obj,
IRubyObject orig) |
protected static void |
objInitCopy(IRubyObject obj,
IRubyObject orig) |
IRubyObject |
op_cmp(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_eqq(ThreadContext context,
IRubyObject other) |
IRubyObject |
op_equal_19(ThreadContext context,
IRubyObject obj)
Deprecated.
|
IRubyObject |
op_equal(ThreadContext context,
IRubyObject obj)
rb_obj_equal
Will by default use identity equality to compare objects.
|
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)
The != method implemented for BasicObject.
|
IRubyObject |
op_not_match(ThreadContext context,
IRubyObject arg)
Invert the match operator.
|
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)
Deprecated.
|
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)
Deprecated.
|
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)
Deprecated.
|
IRubyObject |
rbClone()
RubyMethod clone.
|
IRubyObject |
rbClone(ThreadContext context,
IRubyObject maybeOpts) |
static IRubyObject |
rbInspect(ThreadContext context,
IRubyObject obj) |
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)
Deprecated.
|
RubyBoolean |
respond_to_p(IRubyObject mname,
IRubyObject includePrivate)
Deprecated.
|
RubyBoolean |
respond_to_p19(IRubyObject mname)
Deprecated.
|
RubyBoolean |
respond_to_p19(IRubyObject mname,
IRubyObject includePrivate)
Deprecated.
|
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? and respond_to_missing?
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 incPrivate)
Does this object respond to the specified message via "method_missing?"
|
IRubyObject |
send(ThreadContext context,
Block block)
Deprecated.
|
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,
IRubyObject[] args,
Block block)
Deprecated.
|
IRubyObject |
send19(ThreadContext context,
IRubyObject arg0,
Block block)
Deprecated.
|
IRubyObject |
send19(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1,
Block block)
Deprecated.
|
IRubyObject |
send19(ThreadContext context,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
Block block)
Deprecated.
|
void |
setFFIHandle(java.lang.Object value) |
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 |
setNativeHandle(java.lang.Object value)
Deprecated.
|
void |
setTaint(boolean taint)
Sets the taint flag.
|
void |
setUntrusted(boolean untrusted)
Deprecated.
|
void |
setVariable(int index,
java.lang.Object value) |
static IRubyObject |
singleton_method_added(ThreadContext context,
IRubyObject recv,
IRubyObject symbolId,
Block block) |
static IRubyObject |
singleton_method_added19(ThreadContext context,
IRubyObject recv,
IRubyObject symbolId,
Block block)
Deprecated.
|
static IRubyObject |
singleton_method_removed(ThreadContext context,
IRubyObject recv,
IRubyObject symbolId,
Block block) |
static IRubyObject |
singleton_method_removed19(ThreadContext context,
IRubyObject recv,
IRubyObject symbolId,
Block block)
Deprecated.
|
static IRubyObject |
singleton_method_undefined(ThreadContext context,
IRubyObject recv,
IRubyObject symbolId,
Block block) |
static IRubyObject |
singleton_method_undefined19(ThreadContext context,
IRubyObject recv,
IRubyObject symbolId,
Block block)
Deprecated.
|
IRubyObject |
singleton_method(IRubyObject name) |
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.
|
IRubyObject |
specificEval(ThreadContext context,
RubyModule mod,
Block block,
EvalType evalType)
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,
EvalType evalType)
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,
EvalType evalType)
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,
EvalType evalType)
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)
Deprecated.
|
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.
|
<T> T |
toJava(java.lang.Class<T> target)
Convert the object to the specified Java class, if possible.
|
IRubyObject |
trust(ThreadContext context)
Deprecated.
|
RubyClass |
type_deprecated()
Deprecated.
|
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)
Deprecated.
|
RubyBoolean |
untrusted_p(ThreadContext context)
Deprecated.
|
protected java.lang.String |
validateInstanceVariable(IRubyObject name) |
protected java.lang.String |
validateInstanceVariable(IRubyObject name,
java.lang.String _unused_)
Deprecated.
|
protected java.lang.String |
validateInstanceVariable(java.lang.String name)
Deprecated.
|
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)
Deprecated.
|
protected java.lang.Object |
variableTableFastFetch(java.lang.String internedName)
Deprecated.
|
protected java.lang.Object |
variableTableFastStore(java.lang.String internedName,
java.lang.Object value)
Deprecated.
|
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,
EvalType evalType)
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,
EvalType evalType)
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 transient RubyClass metaClass
protected int flags
public transient java.lang.Object[] varTable
public transient volatile int varTableStamp
public static final long VAR_TABLE_OFFSET
public static final long STAMP_OFFSET
public static final java.lang.String ERR_INSECURE_SET_INST_VAR
public static final int ALL_F
public static final int FALSE_F
public static final int NIL_F
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.public static final int FROZEN_F
public static final int TAINTED_F
public static final IRubyObject NEVER
public static final IRubyObject UNDEF
public static final ObjectAllocator BASICOBJECT_ALLOCATOR
ObjectAllocator
@Deprecated public static final int UNTRUST_F
@Deprecated public static final int FL_USHIFT
@Deprecated public static final int USER0_F
@Deprecated public static final int USER1_F
@Deprecated public static final int USER2_F
@Deprecated public static final int USER3_F
@Deprecated public static final int USER4_F
@Deprecated public static final int USER5_F
@Deprecated public static final int USER6_F
@Deprecated public static final int USER7_F
@Deprecated public static final int USER8_F
@Deprecated public static final int USER9_F
@Deprecated public static final int USERA_F
@Deprecated public static final int REFINED_MODULE_F
@Deprecated public static final int IS_OVERLAID_F
@Deprecated public static final int COMPARE_BY_IDENTITY_F
public RubyBasicObject(Ruby runtime, RubyClass metaClass)
public RubyBasicObject(RubyClass metaClass)
protected RubyBasicObject(Ruby runtime, RubyClass metaClass, boolean useObjectSpace)
public static RubyClass createBasicObjectClass(Ruby runtime, RubyClass objectClass)
public IRubyObject initialize(ThreadContext context)
@Deprecated public IRubyObject initialize19(ThreadContext context)
protected final void testFrozen(java.lang.String message)
protected final void testFrozen()
public final void setFlag(int flag, boolean set)
flag
- the actual flag to set or unset.set
- if true, the flag will be set, if false, the flag will be unset.public final boolean getFlag(int flag)
flag
- the flag to getpublic final IRubyObject checkCallMethod(ThreadContext context, java.lang.String name)
checkCallMethod
in interface IRubyObject
public final IRubyObject checkCallMethod(ThreadContext context, JavaSites.CheckedSites sites)
checkCallMethod
in interface IRubyObject
public final IRubyObject callMethod(ThreadContext context, java.lang.String name)
callMethod
in interface IRubyObject
public final IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject arg)
callMethod
in interface IRubyObject
public final IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject[] args)
callMethod
in interface IRubyObject
public final IRubyObject callMethod(java.lang.String name, IRubyObject... args)
public final IRubyObject callMethod(java.lang.String name, IRubyObject arg)
public final IRubyObject callMethod(java.lang.String name)
public final IRubyObject callMethod(ThreadContext context, java.lang.String name, IRubyObject[] args, Block block)
callMethod
in interface IRubyObject
public final boolean isNil()
NIL_F
flag for more information.isNil
in interface IRubyObject
nil
onlypublic final boolean isTrue()
FALSE_F
flag.isTrue
in interface IRubyObject
nil
and false
, true otherwisepublic final boolean isFalse()
FALSE_F
flag.public boolean isTaint()
isTaint
in interface IRubyObject
public void setTaint(boolean taint)
setTaint
in interface IRubyObject
taint
- should this object be tainted or not?public IRubyObject infectBy(IRubyObject obj)
infectBy
in interface IRubyObject
public boolean isFrozen()
isFrozen
in interface IRubyObject
public void setFrozen(boolean frozen)
setFrozen
in interface IRubyObject
frozen
- should this object be frozen?public boolean isImmediate()
isImmediate
in interface IRubyObject
public boolean isSpecialConst()
isSpecialConst
in interface IRubyObject
public boolean isSpecialObject()
public final RubyClass getMetaClass()
getMetaClass
in interface IRubyObject
public static RubyClass getMetaClass(IRubyObject arg)
public RubyClass getSingletonClass()
getSingletonClass
in interface IRubyObject
public RubyClass makeMetaClass(RubyClass superClass)
public void setMetaClass(RubyClass metaClass)
public final RubyClass getType()
IRubyObject
getType
in interface IRubyObject
IRubyObject.getType()
public final boolean respondsTo(java.lang.String name)
respondsTo
in interface IRubyObject
public final boolean respondsToMissing(java.lang.String name)
respondsToMissing
in interface IRubyObject
public final boolean respondsToMissing(java.lang.String name, boolean incPrivate)
respondsToMissing
in interface IRubyObject
public final Ruby getRuntime()
getRuntime
in interface IRubyObject
public java.lang.Class getJavaClass()
getJavaClass
in interface IRubyObject
public java.lang.String asJavaString()
asJavaString
in interface IRubyObject
public RubyString asString()
anyToString()
is used
instead.asString
in interface IRubyObject
public RubyArray convertToArray()
convertToArray
in interface IRubyObject
public RubyHash convertToHash()
convertToHash
in interface IRubyObject
public RubyFloat convertToFloat()
convertToFloat
in interface IRubyObject
public RubyInteger convertToInteger()
convertToInteger
in interface IRubyObject
public RubyInteger convertToInteger(java.lang.String convertMethod)
convertToInteger
in interface IRubyObject
convertMethod
- conversion method to use e.g. "to_i"public RubyString convertToString()
convertToString
in interface IRubyObject
public IRubyObject anyToString()
anyToString
in interface IRubyObject
public RubyString decode(java.lang.String id)
public IRubyObject checkStringType()
checkStringType
in interface IRubyObject
public final IRubyObject checkStringType19()
checkStringType19
in interface IRubyObject
checkStringType()
public IRubyObject checkArrayType()
checkArrayType
in interface IRubyObject
public <T> T toJava(java.lang.Class<T> target)
IRubyObject
toJava
in interface IRubyObject
target
- The target type to which the object should be converted.IRubyObject.toJava(java.lang.Class<T>)
public IRubyObject dup()
IRubyObject
dup
in interface IRubyObject
protected static boolean OBJ_INIT_COPY(IRubyObject obj, IRubyObject orig)
protected static void objInitCopy(IRubyObject obj, IRubyObject orig)
public void copySpecialInstanceVariables(IRubyObject clone)
copySpecialInstanceVariables
in interface IRubyObject
public IRubyObject rbClone()
IRubyObject
rbClone
in interface IRubyObject
public IRubyObject rbClone(ThreadContext context, IRubyObject maybeOpts)
protected RubyClass getSingletonClassClone()
protected RubyClass getSingletonClassCloneAndAttach(RubyBasicObject attach)
public boolean isModule()
isModule
in interface IRubyObject
(someObject instanceof RubyModule)
instead.public boolean isClass()
isClass
in interface IRubyObject
(someObject instanceof RubyClass/MetaClass)
instead.public void dataWrapStruct(java.lang.Object obj)
IRubyObject
dataWrapStruct
in interface IRubyObject
obj
- the object to wrapIRubyObject.dataWrapStruct(Object)
public java.lang.Object dataGetStruct()
IRubyObject
dataGetStruct
in interface IRubyObject
IRubyObject.dataGetStruct()
public IRubyObject id()
id
in interface IRubyObject
protected long getObjectId()
public IRubyObject inspect()
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"inspect
in interface IRubyObject
public final IRubyObject hashyInspect()
public static IRubyObject rbInspect(ThreadContext context, IRubyObject obj)
protected int inspectHashCode()
public IRubyObject op_not(ThreadContext context)
public IRubyObject op_not_equal(ThreadContext context, IRubyObject other)
context
- thread contextother
- other objectpublic int compareTo(IRubyObject other)
compareTo
in interface java.lang.Comparable<IRubyObject>
other
- another IRubyObjectpublic IRubyObject op_equal(ThreadContext context, IRubyObject obj)
op_equal
in interface IRubyObject
@Deprecated public IRubyObject op_equal_19(ThreadContext context, IRubyObject obj)
public IRubyObject op_eqq(ThreadContext context, IRubyObject other)
op_eqq
in interface IRubyObject
protected static boolean equalInternal(ThreadContext context, IRubyObject that, IRubyObject other)
public boolean eql(IRubyObject other)
eql
in interface IRubyObject
public void addFinalizer(IRubyObject f)
addFinalizer
in interface IRubyObject
public void removeFinalizers()
removeFinalizers
in interface IRubyObject
public java.lang.Object getVariable(int index)
getVariable
in interface IRubyObject
public void setVariable(int index, java.lang.Object value)
setVariable
in interface IRubyObject
public final java.lang.Object getFFIHandle()
public final void setFFIHandle(java.lang.Object value)
public boolean hasVariables()
hasVariables
in interface IRubyObject
VariableTableManager.hasVariables(org.jruby.RubyBasicObject)
public java.util.List<Variable<java.lang.Object>> getVariableList()
getVariableList
in interface IRubyObject
public java.util.List<java.lang.String> getVariableNameList()
getVariableNameList
in interface IRubyObject
protected boolean variableTableContains(java.lang.String name)
protected java.lang.Object variableTableFetch(java.lang.String name)
protected java.lang.Object variableTableStore(java.lang.String name, java.lang.Object value)
protected java.lang.Object variableTableRemove(java.lang.String name)
protected void variableTableSync(java.util.List<Variable<java.lang.Object>> vars)
public InternalVariables getInternalVariables()
getInternalVariables
in interface IRubyObject
public boolean hasInternalVariable(java.lang.String name)
InternalVariables
hasInternalVariable
in interface InternalVariables
name
- the name of an internal variableInternalVariables.hasInternalVariable(java.lang.String)
public java.lang.Object getInternalVariable(java.lang.String name)
InternalVariables
getInternalVariable
in interface InternalVariables
name
- the name of an internal variableInternalVariables.getInternalVariable(java.lang.String)
public void setInternalVariable(java.lang.String name, java.lang.Object value)
InternalVariables
setInternalVariable
in interface InternalVariables
name
- the name of an internal variablevalue
- the value to be setInternalVariables.setInternalVariable(java.lang.String, java.lang.Object)
public java.lang.Object removeInternalVariable(java.lang.String name)
InternalVariables
removeInternalVariable
in interface InternalVariables
name
- the name of the variable to removeInternalVariables.removeInternalVariable(java.lang.String)
public void syncVariables(IRubyObject other)
syncVariables
in interface IRubyObject
other
- the source object containing the variables to syncpublic InstanceVariables getInstanceVariables()
getInstanceVariables
in interface IRubyObject
public boolean hasInstanceVariable(java.lang.String name)
InstanceVariables
hasInstanceVariable
in interface InstanceVariables
name
- the name of an instance variableInstanceVariables.hasInstanceVariable(java.lang.String)
public IRubyObject getInstanceVariable(java.lang.String name)
InstanceVariables
getInstanceVariable
in interface InstanceVariables
name
- the name of an instance variableInstanceVariables.getInstanceVariable(java.lang.String)
public IRubyObject setInstanceVariable(java.lang.String name, IRubyObject value)
setInstanceVariable
in interface InstanceVariables
name
- the name of an instance variablevalue
- the value to be setInstanceVariables.setInstanceVariable(java.lang.String, org.jruby.runtime.builtin.IRubyObject)
public IRubyObject removeInstanceVariable(java.lang.String name)
InstanceVariables
removeInstanceVariable
in interface InstanceVariables
name
- the name of the variable to removeInstanceVariables.removeInstanceVariable(java.lang.String)
public java.util.List<Variable<IRubyObject>> getInstanceVariableList()
getInstanceVariableList
in interface InstanceVariables
public java.util.List<java.lang.String> getInstanceVariableNameList()
getInstanceVariableNameList
in interface InstanceVariables
public void copyInstanceVariablesInto(InstanceVariables other)
InstanceVariables
copyInstanceVariablesInto
in interface InstanceVariables
InstanceVariables.getInstanceVariableNameList()
public final void ensureInstanceVariablesSettable()
@Deprecated public final int getNativeTypeIndex()
CoreObjectType
getNativeTypeIndex
in interface CoreObjectType
public ClassIndex getNativeClassIndex()
CoreObjectType
getNativeClassIndex
in interface CoreObjectType
public boolean isBuiltin(java.lang.String methodName)
methodName
- to look for.public static IRubyObject singleton_method_added(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
public static IRubyObject singleton_method_removed(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
public static IRubyObject singleton_method_undefined(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
@Deprecated public static IRubyObject singleton_method_added19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
@Deprecated public static IRubyObject singleton_method_removed19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
@Deprecated public static IRubyObject singleton_method_undefined19(ThreadContext context, IRubyObject recv, IRubyObject symbolId, Block block)
public static IRubyObject method_missing(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block)
@Deprecated public static IRubyObject method_missing19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block)
public IRubyObject send(ThreadContext context, IRubyObject arg0, Block block)
public IRubyObject send(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
public IRubyObject send(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
public IRubyObject send(ThreadContext context, IRubyObject[] args, Block block)
protected IRubyObject yieldUnder(ThreadContext context, RubyModule under, IRubyObject[] args, Block block, EvalType evalType)
protected IRubyObject yieldUnder(ThreadContext context, RubyModule under, Block block, EvalType evalType)
public IRubyObject specificEval(ThreadContext context, RubyModule mod, Block block, EvalType evalType)
public IRubyObject specificEval(ThreadContext context, RubyModule mod, IRubyObject arg, Block block, EvalType evalType)
public IRubyObject specificEval(ThreadContext context, RubyModule mod, IRubyObject arg0, IRubyObject arg1, Block block, EvalType evalType)
public IRubyObject specificEval(ThreadContext context, RubyModule mod, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block, EvalType evalType)
protected RubyModule getInstanceEvalClass()
public IRubyObject evalUnder(ThreadContext context, RubyModule under, RubyString src, java.lang.String file, int line, EvalType evalType)
public IRubyObject equal_p(ThreadContext context, IRubyObject other)
@Deprecated public IRubyObject equal_p19(ThreadContext context, IRubyObject other)
public IRubyObject eql_p(IRubyObject obj)
public IRubyObject op_cmp(ThreadContext context, IRubyObject other)
public IRubyObject initialize_copy(IRubyObject original)
public void checkFrozen()
testFrozen(java.lang.String)
.@Deprecated public final RubyBoolean respond_to_p(IRubyObject mname)
@Deprecated public final RubyBoolean respond_to_p19(IRubyObject mname)
@Deprecated public final RubyBoolean respond_to_p(IRubyObject mname, IRubyObject includePrivate)
@Deprecated public final RubyBoolean respond_to_p19(IRubyObject mname, IRubyObject includePrivate)
public RubyFixnum hash()
public RubyClass type()
@Deprecated public RubyClass type_deprecated()
public IRubyObject display(ThreadContext context, IRubyObject[] args)
$>
).
Equivalent to:
def display(port=$>)
port.write self
end
For example:
1.display
"cat".display
[ 4, 5, 6 ].display
puts
produces:
1cat456public RubyBoolean tainted_p(ThreadContext context)
true
if the object is tainted.public IRubyObject taint(ThreadContext context)
$SAFE
level is
set appropriately, many method calls which might alter the running
programs environment will refuse to accept tainted strings.@Deprecated protected final void taint(Ruby runtime)
public IRubyObject untaint(ThreadContext context)
public IRubyObject freeze(ThreadContext context)
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:3public RubyBoolean frozen_p(ThreadContext context)
public RubyBoolean instance_of_p(ThreadContext context, IRubyObject type)
true
if obj is an instance of the given
class. See also Object#kind_of?
.public RubyBoolean kind_of_p(ThreadContext context, IRubyObject type)
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 #=> truepublic IRubyObject methods(ThreadContext context, IRubyObject... args)
@Deprecated public IRubyObject methods19(ThreadContext context, IRubyObject[] args)
@Deprecated public final IRubyObject methods(ThreadContext context, IRubyObject[] args, boolean useSymbols)
public IRubyObject public_methods(ThreadContext context, IRubyObject[] args)
false
, only those methods
in the receiver will be listed.@Deprecated public IRubyObject public_methods19(ThreadContext context, IRubyObject[] args)
public IRubyObject protected_methods(ThreadContext context, IRubyObject[] args)
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.@Deprecated public IRubyObject protected_methods19(ThreadContext context, IRubyObject[] args)
public IRubyObject private_methods(ThreadContext context, IRubyObject[] args)
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.@Deprecated public IRubyObject private_methods19(ThreadContext context, IRubyObject[] args)
public RubyArray singleton_methods(ThreadContext context, IRubyObject[] args)
public IRubyObject singleton_method(IRubyObject name)
public IRubyObject method(IRubyObject name)
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)@Deprecated public IRubyObject method19(IRubyObject name)
public IRubyObject to_s()
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.''public RubyArray to_a()
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.public IRubyObject instance_eval(ThreadContext context, Block block)
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 initializepublic IRubyObject instance_eval(ThreadContext context, IRubyObject arg0, Block block)
public IRubyObject instance_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
public IRubyObject instance_eval(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
@Deprecated public IRubyObject instance_eval19(ThreadContext context, Block block)
@Deprecated public IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, Block block)
@Deprecated public IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
@Deprecated public IRubyObject instance_eval19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
public IRubyObject instance_exec(ThreadContext context, IRubyObject[] args, Block block)
@Deprecated public IRubyObject instance_exec19(ThreadContext context, IRubyObject[] args, Block block)
public IRubyObject extend(IRubyObject[] args)
@Deprecated public IRubyObject send(ThreadContext context, Block block)
class Klass def hello(*args) "Hello " + args.join(' ') end end k = Klass.new k.send :hello, "gentle", "readers"
@Deprecated public IRubyObject send19(ThreadContext context, IRubyObject arg0, Block block)
@Deprecated public IRubyObject send19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
@Deprecated public IRubyObject send19(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
@Deprecated public IRubyObject send19(ThreadContext context, IRubyObject[] args, Block block)
public IRubyObject nil_p(ThreadContext context)
true
to nil?
.public IRubyObject op_match(ThreadContext context, IRubyObject arg)
Regexp
and String
) to provide meaningful
pattern-match semantics.public IRubyObject op_match19(ThreadContext context, IRubyObject arg)
public IRubyObject op_not_match(ThreadContext context, IRubyObject arg)
context
- arg
- public IRubyObject instance_variable_defined_p(ThreadContext context, IRubyObject name)
true
if the given instance variable is
defined in obj.
class Fred
def initialize(p1, p2)public IRubyObject instance_variable_get(ThreadContext context, IRubyObject name)
@
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)public IRubyObject instance_variable_set(IRubyObject name, IRubyObject value)
public IRubyObject remove_instance_variable(ThreadContext context, IRubyObject name, Block block)
public RubyArray instance_variables(ThreadContext context)
@Deprecated public RubyArray instance_variables19(ThreadContext context)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected static int nonFixnumHashCode(IRubyObject hashValue)
@Deprecated protected java.lang.String validateInstanceVariable(java.lang.String name)
@Deprecated protected java.lang.String validateInstanceVariable(IRubyObject name, java.lang.String _unused_)
protected java.lang.String validateInstanceVariable(IRubyObject name)
@Deprecated public IRubyObject callSuper(ThreadContext context, IRubyObject[] args, Block block)
callSuper
in interface IRubyObject
@Deprecated public final IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String name)
callMethod
in interface IRubyObject
@Deprecated public final IRubyObject callMethod(ThreadContext context, int methodIndex, java.lang.String name, IRubyObject arg)
callMethod
in interface IRubyObject
@Deprecated public RubyInteger convertToInteger(int methodIndex, java.lang.String convertMethod)
convertToInteger
in interface IRubyObject
IRubyObject.convertToInteger(String)
@Deprecated public int getVariableCount()
getVariableCount
in interface IRubyObject
@Deprecated protected boolean variableTableFastContains(java.lang.String internedName)
@Deprecated protected java.lang.Object variableTableFastFetch(java.lang.String internedName)
@Deprecated protected java.lang.Object variableTableFastStore(java.lang.String internedName, java.lang.Object value)
@Deprecated public boolean fastHasInternalVariable(java.lang.String internedName)
fastHasInternalVariable
in interface InternalVariables
@Deprecated public java.lang.Object fastGetInternalVariable(java.lang.String internedName)
fastGetInternalVariable
in interface InternalVariables
@Deprecated public void fastSetInternalVariable(java.lang.String internedName, java.lang.Object value)
fastSetInternalVariable
in interface InternalVariables
@Deprecated public void syncVariables(java.util.List<Variable<java.lang.Object>> variables)
IRubyObject
syncVariables
in interface IRubyObject
variables
- the variables to be set for object@Deprecated public boolean fastHasInstanceVariable(java.lang.String internedName)
fastHasInstanceVariable
in interface InstanceVariables
@Deprecated public IRubyObject fastGetInstanceVariable(java.lang.String internedName)
fastGetInstanceVariable
in interface InstanceVariables
@Deprecated public IRubyObject fastSetInstanceVariable(java.lang.String internedName, IRubyObject value)
fastSetInstanceVariable
in interface InstanceVariables
@Deprecated public boolean isUntrusted()
IRubyObject
isUntrusted
in interface IRubyObject
@Deprecated public void setUntrusted(boolean untrusted)
IRubyObject
setUntrusted
in interface IRubyObject
@Deprecated public RubyBoolean untrusted_p(ThreadContext context)
@Deprecated public IRubyObject untrust(ThreadContext context)
@Deprecated public IRubyObject trust(ThreadContext context)
@Deprecated public final java.lang.Object getNativeHandle()
@Deprecated public final void setNativeHandle(java.lang.Object value)
@Deprecated public java.lang.Object dataGetStructChecked()
dataGetStructChecked
in interface IRubyObject
Copyright © 2001-2018 JRuby. All Rights Reserved.