Top Description Inners Fields Constructors Methods
org.jruby

public Class RubyBasicObject

extends Object
implements Cloneable, IRubyObject, Serializable, Comparable<IRubyObject>, CoreObjectType, InstanceVariables, InternalVariables
Class Inheritance
All Implemented Interfaces
org.jruby.runtime.builtin.InternalVariables, org.jruby.runtime.builtin.InstanceVariables, org.jruby.runtime.marshal.CoreObjectType, java.lang.Comparable, java.io.Serializable, org.jruby.runtime.builtin.IRubyObject, java.lang.Cloneable
Known Direct Subclasses
org.jruby.RubyObject
Annotations
@SuppressWarnings:ComparableType
Imports
org.jcodings.Encoding, org.jruby.anno.JRubyMethod, org.jruby.api.Create, .JRubyAPI, org.jruby.ast.util.ArgsUtil, org.jruby.exceptions.RaiseException, org.jruby.internal.runtime.methods.DynamicMethod, org.jruby.ir.interpreter.Interpreter, org.jruby.java.proxies.JavaProxy, org.jruby.javasupport.JavaUtil, org.jruby.parser.StaticScope, org.jruby.runtime.Arity, .Block, .CallType, .ClassIndex, .Helpers, .JavaSites, .JavaSites.BasicObjectSites, .ObjectAllocator, .ThreadContext, .Visibility, org.jruby.runtime.backtrace.RubyStackTraceElement, org.jruby.runtime.builtin.IRubyObject, .InstanceVariables, .InternalVariables, .Variable, org.jruby.runtime.callsite.CacheEntry, org.jruby.runtime.component.VariableEntry, org.jruby.runtime.ivars.VariableAccessor, .VariableTableManager, org.jruby.runtime.marshal.CoreObjectType, org.jruby.util.ArraySupport, .ByteList, .IdUtil, .TypeConverter, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.ArrayList, .Collections, .HashSet, .List, .Map, .Set, java.util.concurrent.atomic.AtomicBoolean, java.util.function.BiConsumer, .Consumer

RubyBasicObject is the only implementation of the org.jruby.runtime.builtin.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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
RubyBasicObject.Finalizer

Class that keeps track of the finalizers for the object under operation.

Field Summary

Modifier and TypeField and Description
public static final int
public static final ObjectAllocator
BASICOBJECT_ALLOCATOR

Default allocator instance for all Ruby objects.

public static final int
public static final String
ERR_INSECURE_SET_INST_VAR

The error message used when some one tries to modify an instance variable in a high security setting.

public static final int
public static final int
FL_USHIFT

Deprecated
protected int
flags

object flags

public static final int
public static final int
IS_OVERLAID_F

Deprecated
protected transient RubyClass
metaClass

The class of this object

public static final IRubyObject
NEVER

A value that is used as a null sentinel in among other places the RubyArray implementation.

public static final int
NIL_F

This flag is a bit funny.

public static final int
REFINED_MODULE_F

Deprecated
public static final long
STAMP_OFFSET

Deprecated
public static final int
TAINTED_F

Deprecated
public static final IRubyObject
UNDEF

A value that specifies an undefined value.

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 long
VAR_TABLE_OFFSET

Deprecated
public transient Object[]
varTable

variable table, lazily allocated as needed (if needed)

public transient volatile int
varTableStamp

locking stamp for Unsafe ops updating the vartable

Constructor Summary

AccessConstructor and Description
private
RubyBasicObject()

It's not valid to create a totally empty RubyObject.

public
RubyBasicObject(Ruby
the runtime
runtime
,
RubyClass
the meta class
metaClass
)

Standard path for object creation.

public
RubyBasicObject(RubyClass
the new metaclass
metaClass
)

Path for objects that don't enter objectspace.

protected
RubyBasicObject(Ruby
the runtime
runtime
,
RubyClass
the metaclass
metaClass
,
boolean
should object space be enabled
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

Method Summary

Modifier and TypeMethod and Description
public void
public IRubyObject
addFinalizer(ThreadContext context, IRubyObject f)

Overrides default org.jruby.runtime.builtin.IRubyObject.addFinalizer.

Adds the specified object as a finalizer for this object.

public IRubyObject
anyToString()

Implements org.jruby.runtime.builtin.IRubyObject.anyToString.

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

public String

Returns:

a (Java) string
asJavaString
()

Implements org.jruby.runtime.builtin.IRubyObject.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.

public RubyString
asString()

Implements org.jruby.runtime.builtin.IRubyObject.asString.

rb_obj_as_string First converts this object into a String using the "to_s" method and returns it.

public final IRubyObject
callMethod(ThreadContext context, String name)

Implements org.jruby.runtime.builtin.IRubyObject.callMethod.

Will invoke a named method with no arguments and no block.

public final IRubyObject
callMethod(ThreadContext context, String name, IRubyObject arg)

Implements org.jruby.runtime.builtin.IRubyObject.callMethod.

Will invoke a named method with one argument and no block with functional invocation.

public final IRubyObject
callMethod(ThreadContext context, String name, IRubyObject[] args)

Implements org.jruby.runtime.builtin.IRubyObject.callMethod.

Will invoke a named method with the supplied arguments and no block with functional invocation.

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

public final IRubyObject
public final IRubyObject
public final IRubyObject
callMethod(ThreadContext context, String name, IRubyObject[] args, Block block)

Implements org.jruby.runtime.builtin.IRubyObject.callMethod.

Will invoke a named method with the supplied arguments and supplied block with functional invocation.

public final IRubyObject
callMethod(ThreadContext context, int methodIndex, String name)

Implements org.jruby.runtime.builtin.IRubyObject.callMethod.

Deprecated

public final IRubyObject
callMethod(ThreadContext context, int methodIndex, String name, IRubyObject arg)

Implements org.jruby.runtime.builtin.IRubyObject.callMethod.

Deprecated

public IRubyObject
public IRubyObject
checkArrayType()

Implements org.jruby.runtime.builtin.IRubyObject.checkArrayType.

rb_check_array_type Returns the result of trying to convert this object to an Array with "to_ary".

public final IRubyObject
checkCallMethod(ThreadContext context, String name)

Implements org.jruby.runtime.builtin.IRubyObject.checkCallMethod.

Will invoke a named method with no arguments and no block if that method or a custom method missing exists.

public final IRubyObject
checkCallMethod(ThreadContext context, JavaSites.CheckedSites sites)

Implements org.jruby.runtime.builtin.IRubyObject.checkCallMethod.

Will invoke a named method with no arguments and no block if that method or a custom method missing exists.

public void
checkFrozen()

The actual method that checks frozen with the default frozen message from MRI.

public IRubyObject
checkStringType()

Implements org.jruby.runtime.builtin.IRubyObject.checkStringType.

rb_check_string_type Tries to return a coerced string representation of this object, using "to_str".

protected RubyBasicObject
public int

Returns:

0 if equal, < 0 if this is less than other, > 0 if this is greater than other
compareTo
(IRubyObject
another IRubyObject
other
)

Implements java.lang.Comparable.compareTo.

Compares this Ruby object with another.

public RubyArray<T extends IRubyObject>

Returns:

array representation of this
convertToArray
()

Implements org.jruby.runtime.builtin.IRubyObject.convertToArray.

Tries to convert this object to a Ruby Array using the "to_ary" method.

public RubyFloat

Returns:

float representation of this
convertToFloat
()

Implements org.jruby.runtime.builtin.IRubyObject.convertToFloat.

Tries to convert this object to a Ruby Float using the "to_f" method.

public RubyHash

Returns:

hash representation of this
convertToHash
()

Implements org.jruby.runtime.builtin.IRubyObject.convertToHash.

Tries to convert this object to a Ruby Hash using the "to_hash" method.

public RubyInteger

Returns:

an integer representation of this
convertToInteger
()

Implements org.jruby.runtime.builtin.IRubyObject.convertToInteger.

Tries to convert this object to a Ruby Integer using the "to_int" method.

public RubyInteger

Returns:

an integer representation of this
convertToInteger
(String
conversion method to use e.g. "to_i"
convertMethod
)

Implements org.jruby.runtime.builtin.IRubyObject.convertToInteger.

Tries to convert this object to a Ruby Integer using the supplied conversion method.

public RubyInteger
convertToInteger(int
index
methodIndex
,
String
conversion method name
convertMethod
)

Overrides default org.jruby.runtime.builtin.IRubyObject.convertToInteger.

Deprecated

convert this object to an integer

public RubyString

Returns:

a string representation of this
convertToString
()

Implements org.jruby.runtime.builtin.IRubyObject.convertToString.

Tries to convert this object to a Ruby String using the "to_str" method.

public void
copyInstanceVariablesInto(final InstanceVariables
the thing to copy into
other
)

Implements org.jruby.runtime.builtin.InstanceVariables.copyInstanceVariablesInto.

Copies all instance variables from the given object into the receiver

public void
copySpecialInstanceVariables(IRubyObject clone)

Implements org.jruby.runtime.builtin.IRubyObject.copySpecialInstanceVariables.

Lots of MRI objects keep their state in non-lookupable ivars (e:g.

public Object
dataGetStruct()

Implements org.jruby.runtime.builtin.IRubyObject.dataGetStruct.

Our version of Data_Get_Struct.

public synchronized Object
public void
dataWrapStruct(Object
the object to wrap
obj
)

Implements org.jruby.runtime.builtin.IRubyObject.dataWrapStruct.

Our version of Data_Wrap_Struct.

public RubyString

Returns:

the string of the symbol found from id
decode
(String
the id of the string
id
)

raw (id) strings are not properly encoded but in an iso_8859_1 form.

pack-priv final <T> T
defaultToJava(Class<T> target)

public IRubyObject
public IRubyObject
dup()

Implements org.jruby.runtime.builtin.IRubyObject.dup.

RubyMethod dup.

protected void
dupFinalizer()

Stange method.

protected RubyBasicObject
public void
ensureInstanceVariablesSettable()

Makes sure that instance variables can be set on this object, including information about whether this object is frozen.

public boolean

Returns:

Will by default just call the Ruby method "eql?"
eql
(IRubyObject other)

Implements org.jruby.runtime.builtin.IRubyObject.eql.

method used for Hash key comparison (specialized for String, Symbol and Fixnum)

public IRubyObject
eql_p(IRubyObject obj)
Deprecated since 10.0.

public IRubyObject
protected static boolean

Returns:

are they equal
eqlInternal
(final ThreadContext
the thread context
context
,
final IRubyObject
first comparator
that
,
final IRubyObject
the second comparator
other
)

Helper method for checking equality, first using Java identity equality, and then calling the "eql?" method.

public IRubyObject

Returns:

are they equal?
equal_p
(ThreadContext
the thread context
context
,
IRubyObject
to compare with
other
)

rb_obj_equal Will use Java identity equality.

protected static boolean

Returns:

are they equal
equalInternal
(final ThreadContext
the thread context
context
,
final IRubyObject
first comparator
that
,
final IRubyObject
the second comparator
other
)

Helper method for checking equality, first using Java identity equality, and then calling the "==" method.

public boolean

Returns:

true if equals
equals
(Object
object to compare
other
)

Overrides java.lang.Object.equals.

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.

public IRubyObject
evalUnder(final ThreadContext context, RubyModule under, RubyString src, String file, int line, EvalType evalType)

public IRubyObject

Returns:

itself
extend
(IRubyObject[]
to use as modules to extend
args
)

rb_obj_extend call-seq: obj.extend(module, ...) => obj Adds to _obj_ the instance methods from each module given as a parameter.

public IRubyObject
public Object
public boolean
public boolean
public IRubyObject
public void
public static void
finishBasicObjectClass(ThreadContext
the thread context
context
,
RubyClass
reference to BasicObject
BasicObject
)

Will create the Ruby class BasicObject in the runtime specified.

public void
forEachInstanceVariable(BiConsumer<String, IRubyObject>
a consumer for each variable
accessor
)

Overrides default org.jruby.runtime.builtin.InstanceVariables.forEachInstanceVariable.

Iterate over all instance variable name/value pairs for this object.

public void
forEachInstanceVariableName(Consumer<String>
consumer for the names
consumer
)

Overrides default org.jruby.runtime.builtin.InstanceVariables.forEachInstanceVariableName.

Iterate over all instance variable names for this object.

public IRubyObject
public RubyBoolean
public final ThreadContext
getCurrentContext()
Deprecated

public final Object
public final boolean

Returns:

true if the flag is set, false otherwise
getFlag
(int
the flag to get
flag
)

Get the value of a custom flag on this object.

protected RubyModule
getInstanceEvalClass()
Deprecated since 10.0.

protected RubyModule
public IRubyObject
getInstanceVariable(String
the name of an instance variable
name
)

Implements org.jruby.runtime.builtin.InstanceVariables.getInstanceVariable.

Returns the named instance variable if present, else null.

public List<Variable<IRubyObject>>
getInstanceVariableList()

Implements org.jruby.runtime.builtin.InstanceVariables.getInstanceVariableList.

Gets a list of all variables in this object.

public List<String>
public InstanceVariables
getInstanceVariables()

Implements org.jruby.runtime.builtin.IRubyObject.getInstanceVariables.

Dummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.

public Object
getInternalVariable(String
the name of an internal variable
name
)

Implements org.jruby.runtime.builtin.InternalVariables.getInternalVariable.

Returns the named internal variable if present, else null.

public InternalVariables
getInternalVariables()

Implements org.jruby.runtime.builtin.IRubyObject.getInternalVariables.

Dummy method to avoid a cast, and to avoid polluting the IRubyObject interface with all the instance variable management methods.

public Class<?>

Returns:

the true Java class of this (Ruby) object
getJavaClass
()

Implements org.jruby.runtime.builtin.IRubyObject.getJavaClass.

Will return the Java interface that most closely can represent this object, when working through Java integration translations.

public List<Variable<Object>>
public final RubyClass
getMetaClass()

Implements org.jruby.runtime.builtin.IRubyObject.getMetaClass.

if exist return the meta-class else return the type of the object.

public static RubyClass
public ClassIndex
getNativeClassIndex()

Implements org.jruby.runtime.marshal.CoreObjectType.getNativeClassIndex.

Return the ClassIndex for the native type this object was constructed from.

public final Object
getNativeHandle()
Deprecated

public final int
getNativeTypeIndex()

Implements org.jruby.runtime.marshal.CoreObjectType.getNativeTypeIndex.

Deprecated

Return the ClassIndex value for the native type this object was constructed from.

protected long

Returns:

object id
getObjectId
()

The logic here is to use the special objectId accessor slot from the parent as a lazy store for an object symbol.

public final Ruby

Returns:

current runtime
getRuntime
()

Implements org.jruby.runtime.builtin.IRubyObject.getRuntime.

Will return the runtime that this object is associated with.

public RubyClass
protected RubyClass
getSingletonClassClone()
Deprecated since 10.0.

protected RubyClass
getSingletonClassCloneAndAttach(RubyBasicObject attach)
Deprecated since 10.0.

protected RubyClass

Returns:

either a real class, or a clone of the current singleton class
getSingletonClassCloneAndAttach
(ThreadContext
the thread context
context
,
RubyBasicObject
object ot attach
attach
)

rb_singleton_class_clone Will make sure that if the current objects class is a singleton, it will get cloned.

public final RubyClass
getType()

Implements org.jruby.runtime.builtin.IRubyObject.getType.

RubyMethod getType.

public Object
public int
public List<Variable<Object>>
getVariableList()

Implements org.jruby.runtime.builtin.IRubyObject.getVariableList.

Gets a list of all variables in this object.

public List<String>
getVariableNameList()

Implements org.jruby.runtime.builtin.IRubyObject.getVariableNameList.

Gets a name list of all variables in this object.

public RubyFixnum

Returns:

hash value
hash
()
Deprecated since 10.0. Use RubyBasicObject#hash(ThreadContext) instead.

Will return the hash code of this object.

public RubyFixnum

Returns:

the hash value
hash
(ThreadContext
the current thread context
context
)

Will return the hash code of this object.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Override the Object#hashCode method to make sure that the Ruby hash is actually used as the hashcode for Ruby objects.

public final IRubyObject
public boolean
hasInstanceVariable(String
the name of an instance variable
name
)

Implements org.jruby.runtime.builtin.InstanceVariables.hasInstanceVariable.

Returns true if object has the named instance variable.

protected boolean

Returns:

true if there are set instance variables, false otherwise
hasInstanceVariables
()

Check whether this object has any *set* instance variables unrelated to object_id, FFI, and ObjectSpace (which also use hidden ivar slots).

public boolean
hasInternalVariable(String
the name of an internal variable
name
)

Implements org.jruby.runtime.builtin.InternalVariables.hasInternalVariable.

Returns true if object has the named internal variable.

public boolean
hasVariables()

Implements org.jruby.runtime.builtin.IRubyObject.hasVariables.

Returns true if object has any variables

public IRubyObject
id()

Implements org.jruby.runtime.builtin.IRubyObject.id.

rb_obj_id Return the internal id of an object.

public IRubyObject
pack-priv final RubyBasicObject
infectBy(RubyBasicObject obj)
Deprecated

pack-priv final RubyBasicObject
infectBy(int tuFlags)
Deprecated

private static void
initCopy(ThreadContext context, IRubyObject clone, IRubyObject original)

init_copy Initializes a copy with variable and special instance variable information, and then call the initialize_copy Ruby method.

public IRubyObject
public IRubyObject

Returns:

a copy
initialize_copy
(IRubyObject
object
original
)

public IRubyObject

Returns:

a copy unless the same thing
initialize_copy
(ThreadContext
the thread context
context
,
IRubyObject
the original
original
)

Initializes this object as a copy of the original, that is the parameter to this object.

public IRubyObject
inspect()

Implements org.jruby.runtime.builtin.IRubyObject.inspect.

Deprecated since 10.0.

RubyMethod inspect.

public IRubyObject
inspect(ThreadContext context)

Overrides default org.jruby.runtime.builtin.IRubyObject.inspect.

Returns a string containing a human-readable representation of obj.

protected int

Returns:

The identity hashcode of this object
inspectHashCode
()

For most objects, the hash used in the default #inspect is just the identity hashcode of the actual object.

private RubyString
inspectObj(final Ruby runtime, RubyString part)

inspect_obj The internal helper method that takes care of the part of the inspection that inspects instance variables.

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

public IRubyObject

Returns:

the result
instance_exec
(ThreadContext
the thread context
context
,
IRubyObject[]
the args
args
,
Block
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_).

public RubyBoolean

Returns:

true if this is instance of type
instance_of_p
(ThreadContext
the thread context
context
,
IRubyObject
the type
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.

public IRubyObject

Returns:

true if defined
instance_variable_defined_p
(ThreadContext
the thread context
context
,
IRubyObject
of ivar
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.

public IRubyObject

Returns:

value of ivar
instance_variable_get
(ThreadContext
the thread context
context
,
IRubyObject
of ivar
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.

public IRubyObject

Returns:

value of old set ivar
instance_variable_set
(IRubyObject
of ivar
name
,
IRubyObject
to set
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.

public RubyArray<T extends IRubyObject>

Returns:

list of ivars
instance_variables
(ThreadContext
the thread context
context
)

rb_obj_instance_variables call-seq: obj.instance_variables => array Returns an array of instance variable names for the receiver.

public boolean

Returns:

true if so
isBuiltin
(String
to look for.
methodName
)

A method to determine whether the method named by methodName is a builtin method, i.e. a method built-in to JRuby and loaded during its core boot process.

public boolean
isClass()

Implements org.jruby.runtime.builtin.IRubyObject.isClass.

Specifically polymorphic method that are meant to be overridden by classes to specify that they are classes in an easy way.

public final boolean

Returns:

true is false
isFalse
()

Is this value a falsey value or not?

public boolean

Returns:

true if this object is frozen, false otherwise
isFrozen
()

Implements org.jruby.runtime.builtin.IRubyObject.isFrozen.

Is this value frozen or not?

public boolean
isImmediate()

Implements org.jruby.runtime.builtin.IRubyObject.isImmediate.

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

public boolean
isModule()

Implements org.jruby.runtime.builtin.IRubyObject.isModule.

Specifically polymorphic method that are meant to be overridden by modules to specify that they are modules in an easy way.

public final boolean
isNil()

Implements org.jruby.runtime.builtin.IRubyObject.isNil.

Does this object represent nil?

public boolean
public boolean
public boolean
public final boolean

Returns:

true it truthy
isTrue
()

Implements org.jruby.runtime.builtin.IRubyObject.isTrue.

Is this value a truthy value or not?

public boolean
isUntrusted()

Implements org.jruby.runtime.builtin.IRubyObject.isUntrusted.

Deprecated

RubyMethod isUntrusted.

public RubyBoolean

Returns:

true if this is kind of type
kind_of_p
(ThreadContext
the thread context
context
,
IRubyObject
the type
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.

public RubyClass
makeMetaClass(RubyClass superClass)
Deprecated since 10.0.

public RubyClass

Returns:

the new meta class
makeMetaClass
(ThreadContext
the thread context
context
,
RubyClass
the super class
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.

public RubyClass

Returns:

the new metaclass
makeMetaClassBootstrap
(Ruby
the runtime
runtime
,
RubyClass
of the metaclass
superClass
,
RubyClass
a reference to Ruby Class
Class
)

This will create a new metaclass.

public IRubyObject
method(IRubyObject name)
Deprecated since 10.0.

public IRubyObject
method(IRubyObject name, StaticScope refinedScope)
Deprecated since 10.0.

public IRubyObject

Returns:

method instance
method
(ThreadContext
the thread context
context
,
IRubyObject
the name of the method
name
,
StaticScope
the static scope for the caller method
refinedScope
)

Like method(IRubyObject) but using the given refinement scope to search for the method.

public static IRubyObject
public IRubyObject

Returns:

methods
methods
(ThreadContext
the thread context
context
,
IRubyObject...
include ancestors
args
)

rb_obj_methods call-seq: obj.methods => array Returns a list of the names of methods publicly accessible in obj.

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

pack-priv final IRubyObject
methodsImpl(ThreadContext context, final boolean all)

public IRubyObject

Returns:

true if nil
nil_p
(ThreadContext
the thread context
context
)

rb_false call_seq: nil.nil?

protected static int
nonFixnumHashCode(IRubyObject hashValue)
Deprecated since 10.0.

protected static int
protected static boolean
protected static void
public IRubyObject
public IRubyObject
public IRubyObject
op_equal(ThreadContext context, IRubyObject obj)

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects.

public IRubyObject

Returns:

true if matches (always nil)
op_match
(ThreadContext
the thread context
context
,
IRubyObject
arg
arg
)

rb_obj_pattern_match call-seq: obj =~ other => nil Pattern Match---Overridden by descendents (notably Regexp and String) to provide meaningful pattern-match semantics.

public IRubyObject
public IRubyObject

Returns:

false if this == other, true otherwise
op_not_equal
(ThreadContext
thread context
context
,
IRubyObject
other object
other
)

The != method implemented for BasicObject.

public IRubyObject

Returns:

true if they do not match
op_not_match
(ThreadContext
the thread context
context
,
IRubyObject
arg
arg
)

Invert the match operator.

public IRubyObject
public IRubyObject
public IRubyObject
private void
public IRubyObject
public IRubyObject
rbClone(ThreadContext context, IRubyObject maybeOpts)

private RubyBasicObject
public static IRubyObject
private void
readObject(ObjectInputStream ois)

Deserialization proceeds as follows:

  1. Deserialize the object instance. It will have null metaClass and varTable fields.
  2. Deserialize the name of the object's class, and retrieve class from a thread-local JRuby instance.
  3. Retrieve each variable in turn, re-assigning them by name.
pack-priv static void
private IRubyObject
public IRubyObject

Returns:

value of removed ivar
remove_instance_variable
(ThreadContext
the thread context
context
,
IRubyObject
of ivar
name
,
Block
the block (not used)
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.

public void
removeFinalizers()

Implements org.jruby.runtime.builtin.IRubyObject.removeFinalizers.

Remove all the finalizers for this object.

public IRubyObject
removeInstanceVariable(String
the name of the variable to remove
name
)

Implements org.jruby.runtime.builtin.InstanceVariables.removeInstanceVariable.

Removes the named instance variable, if present, returning its value.

public Object
removeInternalVariable(String
the name of the variable to remove
name
)

Implements org.jruby.runtime.builtin.InternalVariables.removeInternalVariable.

Removes the named internal variable, if present, returning its value.

public final RubyBoolean
respond_to_p(IRubyObject mname)
Deprecated

public final RubyBoolean
respond_to_p(IRubyObject mname, IRubyObject includePrivate)
Deprecated

pack-priv final RubyBoolean
respond_to_p(ThreadContext context, IRubyObject methodName, final boolean includePrivate)

public final boolean
respondsTo(String
method name
name
)

Implements org.jruby.runtime.builtin.IRubyObject.respondsTo.

Does this object respond to the specified message?

public final boolean
respondsToMissing(String
method name
name
)

Implements org.jruby.runtime.builtin.IRubyObject.respondsToMissing.

Does this object respond to the specified message via "method_missing?"

public final boolean
respondsToMissing(String
method name
name
,
boolean
private?
incPrivate
)

Implements org.jruby.runtime.builtin.IRubyObject.respondsToMissing.

Does this object respond to the specified message via "method_missing?"

public IRubyObject
send(ThreadContext context, Block block)
Deprecated

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)

public final void
public final void
setFlag(int
the actual flag to set or unset.
flag
,
boolean
if true, the flag will be set, if false, the flag will be unset.
set
)

Sets or unsets a flag on this object.

public void
setFrozen(boolean
should this object be frozen?
frozen
)

Implements org.jruby.runtime.builtin.IRubyObject.setFrozen.

Sets whether this object is frozen or not.

public IRubyObject
setInstanceVariable(String
the name of an instance variable
name
,
IRubyObject
the value to be set
value
)

Implements org.jruby.runtime.builtin.InstanceVariables.setInstanceVariable.

rb_iv_set / rb_ivar_set

public void
setInternalVariable(String
the name of an internal variable
name
,
Object
the value to be set
value
)

Implements org.jruby.runtime.builtin.InternalVariables.setInternalVariable.

Sets the named internal variable to the specified value.

public void
setMetaClass(RubyClass
the meta class to set
metaClass
)

Makes it possible to change the metaclass of an object.

public final void
setNativeHandle(Object value)
Deprecated

public void
setTaint(boolean taint)

Implements org.jruby.runtime.builtin.IRubyObject.setTaint.

Deprecated

public void
setUntrusted(boolean
boolean
untrusted
)

Implements org.jruby.runtime.builtin.IRubyObject.setUntrusted.

Deprecated

RubyMethod setUntrusted.

private Block
setupBlock(Block block, EvalType evalType)

public void
public IRubyObject
singleton_method(IRubyObject name)
Deprecated since 10.0.

public IRubyObject
public static IRubyObject
public static IRubyObject
public static IRubyObject
public RubyArray<T extends IRubyObject>
public RubyClass

Returns:

the singleton of this type
singletonClass
(ThreadContext
the current thread context
context
)

Overrides default org.jruby.runtime.builtin.IRubyObject.singletonClass.

Will either return the existing singleton class for this object, or create a new one and return that.

private static JavaSites.BasicObjectSites
sites(ThreadContext context)

Retrieve the call sites for this class.

public IRubyObject

Returns:

the result
specificEval
(ThreadContext
the thread context
context
,
RubyModule
module to yield in
mod
,
Block
to call
block
,
EvalType
type of evaal to perform
evalType
)

specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.

public IRubyObject

Returns:

the result
specificEval
(ThreadContext
the thread context
context
,
RubyModule
module to yield in
mod
,
IRubyObject
to pass to block
arg
,
Block
to call
block
,
EvalType
type of evaal to perform
evalType
)

specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.

public IRubyObject

Returns:

the result
specificEval
(ThreadContext
the thread context
context
,
RubyModule
module to yield in
mod
,
IRubyObject
to pass to block
arg0
,
IRubyObject
to pass to block
arg1
,
Block
to call
block
,
EvalType
type of evaal to perform
evalType
)

specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.

public IRubyObject

Returns:

the result
specificEval
(ThreadContext
the thread context
context
,
RubyModule
module to yield in
mod
,
IRubyObject
to pass to block
arg0
,
IRubyObject
to pass to block
arg1
,
IRubyObject
to pass to block
arg2
,
Block
to call
block
,
EvalType
type of evaal to perform
evalType
)

specific_eval Evaluates the block or string inside of the context of this object, using the supplied arguments.

public void
syncVariables(IRubyObject
the source object containing the variables to sync
other
)

Implements org.jruby.runtime.builtin.IRubyObject.syncVariables.

Sync one this object's variables with other's - this is used to make rbClone work correctly.

public void
syncVariables(List<Variable<Object>>
the variables to be set for object
variables
)

Implements org.jruby.runtime.builtin.IRubyObject.syncVariables.

Deprecated

Sets object's variables to those in the supplied list, removing/replacing any previously defined variables.

public IRubyObject
taint(ThreadContext context)
Deprecated

protected final void
taint(Ruby runtime)
Deprecated

pack-priv IRubyObject
tainted()
Deprecated

public RubyBoolean
tainted_p(ThreadContext context)
Deprecated

protected final void
testFrozen(String
is frozen
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.

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.

public RubyArray<T extends IRubyObject>
public RubyArray<T extends IRubyObject>
to_a()
Deprecated

public IRubyObject

Returns:

""
to_s
()
Deprecated since 10.0. Use RubyBasicObject#to_s(ThreadContext) instead.

public IRubyObject
public <T> T
toJava(Class<T>
The target type to which the object should be converted.
target
)

Implements org.jruby.runtime.builtin.IRubyObject.toJava.

Convert the object to the specified Java class, if possible.

public IRubyObject
trust(ThreadContext context)
Deprecated

public RubyClass

Returns:

the real class
type
()

rb_obj_class Returns the real class of this object, excluding any singleton/meta class in the inheritance chain.

public IRubyObject
untaint(ThreadContext context)
Deprecated

public IRubyObject
untrust(ThreadContext context)
Deprecated

public RubyBoolean
untrusted_p(ThreadContext context)
Deprecated

private Object
protected String

Returns:

name it is valid
validateInstanceVariable
(String
of instance variable
name
)
Deprecated

Checks if the name parameter represents a legal instance variable name, and otherwise throws a Ruby NameError

protected String
validateInstanceVariable(IRubyObject name, String _unused_)
Deprecated

protected String
protected boolean

Returns:

if contained in this object
variableTableContains
(String
to lookup
name
)

Checks if the variable table contains a variable of the specified name.

protected boolean
variableTableFastContains(String internedName)
Deprecated

protected Object
variableTableFastFetch(String internedName)
Deprecated

protected Object
variableTableFastStore(String internedName, Object value)
Deprecated

protected Object

Returns:

the object or null if not found
variableTableFetch
(String
to lookup
name
)

Fetch an object from the variable table based on the name.

protected Object

Returns:

the value removed
variableTableRemove
(String
to remove
name
)

Removes the entry with the specified name from the variable table, and returning the removed value.

protected Object

Returns:

value
variableTableStore
(String
to store in
name
,
Object
to store
value
)

Store a value in the variable store under the specific name.

protected void
variableTableSync(List<Variable<Object>>
to to sync with
vars
)

Synchronize the variable table with the argument.

private void
writeObject(ObjectOutputStream oos)

Serialization of a Ruby (basic) object involves three steps:

  1. Dump the object itself
  2. Dump a String used to load the appropriate Ruby class
  3. Dump each variable from varTable in turn
protected IRubyObject

Returns:

the result
yieldUnder
(final ThreadContext
the thread context
context
,
RubyModule
module to yield in
under
,
IRubyObject[]
to use
args
,
Block
to call
block
,
EvalType
type of evaal to perform
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

Returns:

the result
yieldUnder
(final ThreadContext
the thread context
context
,
RubyModule
module to yield in
under
,
Block
to call
block
,
EvalType
type of evaal to perform
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.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait