Class: NilClass

Inherits:
Object show all
Defined in:
lib/source/ruby.rb

Overview

The class of the singleton object nil.

Instance Method Summary collapse

Constructor Details

#initializeNilClass

:nodoc:



4008
4009
4010
# File 'lib/source/ruby.rb', line 4008

def initialize # :nodoc:
  `this._objectId=4`
end

Instance Method Details

#&(object) ⇒ Object

call-seq:

nil & 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.



4017
4018
4019
# File 'lib/source/ruby.rb', line 4017

def &(object)
  false
end

#^(object) ⇒ Object

call-seq:

nil ^ obj -> true or false

Exclusive Or – if obj is nil or false, returns false; otherwise, returns true.



4035
4036
4037
# File 'lib/source/ruby.rb', line 4035

def ^(object)
  `$T(object)`
end

#inspectObject

call-seq:

nil.inspect -> "nil"

Always returns the string “nil”.



4044
4045
4046
# File 'lib/source/ruby.rb', line 4044

def inspect
  'nil'
end

#nil?Boolean

call-seq:

nil.nil? -> true

Only the object nil responds true to nil?.

Returns:

  • (Boolean)


4053
4054
4055
# File 'lib/source/ruby.rb', line 4053

def nil?
  true
end

#to_aObject

call-seq:

nil.to_a -> []

Always returns an empty array.



4062
4063
4064
# File 'lib/source/ruby.rb', line 4062

def to_a
  []
end

#to_fObject

call-seq:

nil.to_f -> 0

Always returns zero.



4071
4072
4073
# File 'lib/source/ruby.rb', line 4071

def to_f
  0
end

#to_iObject

call-seq:

nil.to_i -> 0

Always returns zero.



4080
4081
4082
# File 'lib/source/ruby.rb', line 4080

def to_i
  0
end

#to_sObject

call-seq:

nil.to_s -> ''

Always returns the empty string.



4089
4090
4091
# File 'lib/source/ruby.rb', line 4089

def to_s
  ''
end

#|(object) ⇒ Object

call-seq:

nil | obj -> true or false

Or – returns false if obj is nil or false; true otherwise.



4026
4027
4028
# File 'lib/source/ruby.rb', line 4026

def |(object)
  `$T(object)`
end