Class: Object

Inherits:
BasicObject
Defined in:
lib/null.rb

Instance Method Summary collapse

Instance Method Details

#!Object

This is an alias for falsy?.



13
14
15
# File 'lib/null.rb', line 13

def !()
	falsy?
end

#falsy?Boolean

falsy? is true iff we are nil, false, or an instance of NullClass.

Returns:

  • (Boolean)


8
9
10
# File 'lib/null.rb', line 8

def falsy?
	false
end

#null?Boolean

Are we null?

Returns:

  • (Boolean)


18
19
20
# File 'lib/null.rb', line 18

def null?
	false
end

#tap? {|_self| ... } ⇒ Boolean

obj.tap?() is equivalent to obj.tap() unless obj is an instance of NullClass, in which case a block must still be given, but will not be executed.

Yields:

  • (_self)

Yield Parameters:

  • _self (Object)

    the object that the method was called on

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/null.rb', line 30

def tap? # yield: self
	yield(self)
	self
end

#to_nil?Boolean

null.to_nil? returns nil; everything else returns self.

Returns:

  • (Boolean)


23
24
25
# File 'lib/null.rb', line 23

def to_nil?()
	self
end

#truthy?Boolean

truthy? is false iff we are nil, false, or an instance of NullClass.

Returns:

  • (Boolean)


3
4
5
# File 'lib/null.rb', line 3

def truthy?
	true
end