Class: VoidClass

Inherits:
NullClass show all
Includes:
NillishConversions
Defined in:
lib/null.rb

Overview

VoidClass instances act like NullClass instances except

Instance Method Summary collapse

Methods included from NillishConversions

#=~, #to_a, #to_c, #to_f, #to_i, #to_json, #to_nil?, #to_param, #to_r, #to_s

Methods inherited from NullClass

#empty?, #nil?, #null?, #present?, #tap?, #to_nil?, #to_s

Methods included from RecursiveMethodMissing

#method_missing

Methods included from TruthyBooleanOperators

#&, #^, #|

Methods included from Falsiness

#!, #falsy?, #truthy?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RecursiveMethodMissing

Instance Method Details

#*(x) ⇒ Object



161
# File 'lib/null.rb', line 161

def *(x) x*self end

#+(x) ⇒ Object



159
# File 'lib/null.rb', line 159

def +(x) x end

#-(x) ⇒ Object



160
# File 'lib/null.rb', line 160

def -(x) -x end

#/(x) ⇒ Object



162
# File 'lib/null.rb', line 162

def /(x) to_i/x end

#coerce(x) ⇒ Object

Become 0 in mathematical operations.



158
# File 'lib/null.rb', line 158

def coerce(x) to_i.coerce(x) end

#inspectObject

“void”



165
166
167
# File 'lib/null.rb', line 165

def inspect
	'void'
end