Class: NilClass

Inherits:
Object show all
Defined in:
re.c,
object.c

Overview

The class of the singleton object nil.

Instance Method Summary collapse

Instance Method Details

#&(obj) ⇒ false #&(obj) ⇒ false

And—Returns false. obj is always evaluated as it is the argument to a method call—there is no short-circuit evaluation in this case.

Overloads:

  • #&(obj) ⇒ false

    Returns:

    • (false)
  • #&(obj) ⇒ false

    Returns:

    • (false)


987
988
989
# File 'object.c', line 987

static VALUE
false_and(obj, obj2)
VALUE obj, obj2;

#^(obj) ⇒ Boolean #^(obj) ⇒ Boolean

Exclusive Or—If obj is nil or false, returns false; otherwise, returns true.

Overloads:

  • #^(obj) ⇒ Boolean

    Returns:

    • (Boolean)
  • #^(obj) ⇒ Boolean

    Returns:

    • (Boolean)


1024
1025
1026
# File 'object.c', line 1024

static VALUE
false_xor(obj, obj2)
VALUE obj, obj2;

#inspectObject

Always returns the string “nil”.



835
836
837
# File 'object.c', line 835

static VALUE
nil_inspect(obj)
VALUE obj;

#nil?Boolean

call_seq:

nil.nil?               => true

Only the object nil responds true to nil?.

Returns:

  • (Boolean)


1038
1039
1040
# File 'object.c', line 1038

static VALUE
rb_true(obj)
VALUE obj;

#to_aArray

Always returns an empty array.

nil.to_a   #=> []

Returns:



821
822
823
# File 'object.c', line 821

static VALUE
nil_to_a(obj)
VALUE obj;

#to_f0.0

Always returns zero.

nil.to_f   #=> 0.0

Returns:

  • (0.0)


789
790
791
# File 'object.c', line 789

static VALUE
nil_to_f(obj)
VALUE obj;

#to_i0

Always returns zero.

nil.to_i   #=> 0

Returns:

  • (0)


773
774
775
# File 'object.c', line 773

static VALUE
nil_to_i(obj)
VALUE obj;

#to_sObject

Always returns the empty string.

nil.to_s   #=> ""


805
806
807
# File 'object.c', line 805

static VALUE
nil_to_s(obj)
VALUE obj;

#|(obj) ⇒ Boolean #|(obj) ⇒ Boolean

Or—Returns false if obj is nil or false; true otherwise.

Overloads:

  • #|(obj) ⇒ Boolean

    Returns:

    • (Boolean)
  • #|(obj) ⇒ Boolean

    Returns:

    • (Boolean)


1004
1005
1006
# File 'object.c', line 1004

static VALUE
false_or(obj, obj2)
VALUE obj, obj2;