Top Fields Constructors Methods
org.jruby

public Class RubyNil

extends RubyObject
implements Constantizable
Class Inheritance
All Implemented Interfaces
org.jruby.compiler.Constantizable
Annotations
@JRubyClass
name:NilClass
Imports
org.jcodings.specific.USASCIIEncoding, org.jruby.anno.JRubyMethod, .JRubyClass, org.jruby.compiler.Constantizable, org.jruby.runtime.Arity, .ClassIndex, .ObjectAllocator, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.opto.OptoFactory, org.jruby.util.ByteList

Field Summary

Modifier and TypeField and Description
private final transient Object
private final int
pack-priv static final ByteList
public static final ObjectAllocator
NIL_ALLOCATOR

Deprecated
pack-priv static final byte[]
Inherited from org.jruby.RubyObject:
IVAR_INSPECTING_OBJECT_ALLOCATOROBJECT_ALLOCATORREIFYING_OBJECT_ALLOCATOR

Constructor Summary

AccessConstructor and Description
public
RubyNil(Ruby runtime, RubyClass Nil)

Method Summary

Modifier and TypeMethod and Description
public Object
public static void
public Class<?>
getJavaClass()

Overrides org.jruby.RubyBasicObject.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 ClassIndex
getNativeClassIndex()

Overrides org.jruby.RubyObject.getNativeClassIndex.

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

This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.

public RubyFixnum
hash(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.hash.

Will return the hash code of this object.

public int
hashCode()

Overrides org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

public RubyFixnum
id()

Overrides org.jruby.RubyBasicObject.id.

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

rb_obj_id Return the internal id of an object.

public IRubyObject
pack-priv static RubyString
inspect(Ruby runtime)

public boolean
isImmediate()

Overrides org.jruby.RubyBasicObject.isImmediate.

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

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

public RubyBoolean
nil_p(ThreadContext
the thread context
context
)

Overrides org.jruby.RubyBasicObject.nil_p.

rb_false call_seq: nil.nil?

public IRubyObject
nil_p()
Deprecated

public static RubyBoolean
op_and(ThreadContext context, IRubyObject recv, IRubyObject obj)

nil_and

public IRubyObject
op_match(ThreadContext
the thread context
context
,
IRubyObject
arg
arg
)

Overrides org.jruby.RubyBasicObject.op_match.

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 static RubyBoolean
op_or(ThreadContext context, IRubyObject recv, IRubyObject obj)

nil_or

public static RubyBoolean
op_xor(ThreadContext context, IRubyObject recv, IRubyObject obj)

nil_xor

public static IRubyObject
rationalize(ThreadContext context, IRubyObject recv, IRubyObject[] args)

nilclass_rationalize

public RubyClass
singletonClass(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.singletonClass.

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.

public IRubyObject
taint(ThreadContext context)

Overrides org.jruby.RubyBasicObject.taint.

Deprecated

public static RubyArray<T extends IRubyObject>
to_a(ThreadContext context, IRubyObject recv)

nil_to_a

public static IRubyObject
to_c(ThreadContext context, IRubyObject recv)

nilclass_to_c

public static RubyFloat
to_f(ThreadContext context, IRubyObject recv)

nil_to_f

public static RubyHash
public static RubyFixnum
to_i(ThreadContext context, IRubyObject recv)

nil_to_i

public static IRubyObject
to_r(ThreadContext context, IRubyObject recv)

nilclass_to_r

public static RubyString
to_s(ThreadContext context, IRubyObject recv)

nil_to_s

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

Overrides org.jruby.RubyBasicObject.toJava.

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

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

Inherited from org.jruby.RubyObject:
attachToObjectSpacecallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitconvertToTypedigdig1dig2eqlInternalequalInternalequalsfinishObjectClassinspectop_eqqputsspecificEvaltoRubyStringtoString

Field Detail

constantback to summary
private final transient Object constant
hashCodeback to summary
private final int hashCode
nilback to summary
pack-priv static final ByteList nil
NIL_ALLOCATORback to summary
public static final ObjectAllocator NIL_ALLOCATOR

Deprecated

Annotations
@Deprecated
nilBytesback to summary
pack-priv static final byte[] nilBytes

Constructor Detail

RubyNilback to summary
public RubyNil(Ruby runtime, RubyClass Nil)

Method Detail

constantback to summary
public Object constant()

Implements org.jruby.compiler.Constantizable.constant.

Annotations
@Override
See Also
org.jruby.compiler.Constantizable
finishNilClassback to summary
public static void finishNilClass(ThreadContext context, RubyClass Nil)
getJavaClassback to summary
public Class<?> getJavaClass()

Overrides org.jruby.RubyBasicObject.getJavaClass.

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

Doc from org.jruby.RubyBasicObject.getJavaClass.

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

Returns:Class<?>

the true Java class of this (Ruby) object

Annotations
@Override
getNativeClassIndexback to summary
public ClassIndex getNativeClassIndex()

Overrides org.jruby.RubyObject.getNativeClassIndex.

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

Doc from org.jruby.RubyObject.getNativeClassIndex.

This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex

Returns:ClassIndex

Doc from org.jruby.runtime.marshal.CoreObjectType.getNativeClassIndex.

the ClassIndex of the native type this object was constructed from

Annotations
@Override
hashback to summary
public RubyFixnum hash(ThreadContext context)

Overrides org.jruby.RubyBasicObject.hash.

Doc from org.jruby.RubyBasicObject.hash.

Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.

Parameters
context:ThreadContext

the current thread context

Returns:RubyFixnum

the hash value

Annotations
@JRubyMethod
hashCodeback to summary
public int hashCode()

Overrides org.jruby.RubyObject.hashCode.

Doc from org.jruby.RubyObject.hashCode.

This override does not do "checked" dispatch since Object usually has #hash defined.

Returns:int

the hash code

Annotations
@Override
idback to summary
public RubyFixnum id()

Overrides org.jruby.RubyBasicObject.id.

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

Doc from org.jruby.RubyBasicObject.id.

rb_obj_id Return the internal id of an object.

Returns:RubyFixnum

Doc from org.jruby.runtime.builtin.IRubyObject.id.

the object id

Annotations
@Override
inspectback to summary
public IRubyObject inspect(ThreadContext context)

Overrides org.jruby.RubyBasicObject.inspect.

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

nil_inspect

Annotations
@JRubyMethod
inspectback to summary
pack-priv static RubyString inspect(Ruby runtime)
isImmediateback to summary
public boolean isImmediate()

Overrides org.jruby.RubyBasicObject.isImmediate.

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

Doc from org.jruby.RubyBasicObject.isImmediate.

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

Returns:boolean

Doc from org.jruby.runtime.builtin.IRubyObject.isImmediate.

boolean

Annotations
@Override
nil_pback to summary
public RubyBoolean nil_p(ThreadContext context)

Overrides org.jruby.RubyBasicObject.nil_p.

Doc from org.jruby.RubyBasicObject.nil_p.

rb_false call_seq: nil.nil? => true <anything_else>.nil? => false Only the object nil responds true to nil?.

Parameters
context:ThreadContext

the thread context

Returns:RubyBoolean

true if nil

Annotations
@Override
@JRubyMethod
name:nil?
nil_pback to summary
public IRubyObject nil_p()

Deprecated

Annotations
@Deprecated
op_andback to summary
public static RubyBoolean op_and(ThreadContext context, IRubyObject recv, IRubyObject obj)

nil_and

Annotations
@JRubyMethod
name:&
op_matchback to summary
public IRubyObject op_match(ThreadContext context, IRubyObject arg)

Overrides org.jruby.RubyBasicObject.op_match.

Doc from org.jruby.RubyBasicObject.op_match.

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

Parameters
context:ThreadContext

the thread context

arg:IRubyObject

arg

Returns:IRubyObject

true if matches (always nil)

Annotations
@Override
@JRubyMethod
name:=~
op_orback to summary
public static RubyBoolean op_or(ThreadContext context, IRubyObject recv, IRubyObject obj)

nil_or

Annotations
@JRubyMethod
name:|
op_xorback to summary
public static RubyBoolean op_xor(ThreadContext context, IRubyObject recv, IRubyObject obj)

nil_xor

Annotations
@JRubyMethod
name:^
rationalizeback to summary
public static IRubyObject rationalize(ThreadContext context, IRubyObject recv, IRubyObject[] args)

nilclass_rationalize

Annotations
@JRubyMethod
optional:1
checkArity:false
singletonClassback to summary
public RubyClass singletonClass(ThreadContext context)

Overrides org.jruby.RubyBasicObject.singletonClass.

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

Doc from org.jruby.RubyBasicObject.singletonClass.

Will either return the existing singleton class for this object, or create a new one and return that. For a few types a singleton class is not possible so it will throw an error.

Parameters
context:ThreadContext

the current thread context

Returns:RubyClass

the singleton of this type

taintback to summary
public IRubyObject taint(ThreadContext context)

Overrides org.jruby.RubyBasicObject.taint.

Deprecated

Annotations
@Deprecated
@Override
to_aback to summary
public static RubyArray<T extends IRubyObject> to_a(ThreadContext context, IRubyObject recv)

nil_to_a

Annotations
@JRubyMethod
to_cback to summary
public static IRubyObject to_c(ThreadContext context, IRubyObject recv)

nilclass_to_c

Annotations
@JRubyMethod
to_fback to summary
public static RubyFloat to_f(ThreadContext context, IRubyObject recv)

nil_to_f

Annotations
@JRubyMethod
to_hback to summary
public static RubyHash to_h(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
to_iback to summary
public static RubyFixnum to_i(ThreadContext context, IRubyObject recv)

nil_to_i

Annotations
@JRubyMethod
to_rback to summary
public static IRubyObject to_r(ThreadContext context, IRubyObject recv)

nilclass_to_r

Annotations
@JRubyMethod
to_sback to summary
public static RubyString to_s(ThreadContext context, IRubyObject recv)

nil_to_s

Annotations
@JRubyMethod
toJavaback to summary
public <T> T toJava(Class<T> target)

Overrides org.jruby.RubyBasicObject.toJava.

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

Doc from org.jruby.runtime.builtin.IRubyObject.toJava.

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

Parameters
<T>
type
target:Class<T>

The target type to which the object should be converted.

Returns:T

java type

Annotations
@Override