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_null?, #to_param, #to_r, #to_s

Methods inherited from NullClass

#empty?, #nil?, #null?, #present?, #tap?, #to_nil?, #to_null?, #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



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

def *(x) x*self end

#+(x) ⇒ Object



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

def +(x) x end

#-(x) ⇒ Object



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

def -(x) -x end

#/(x) ⇒ Object



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

def /(x) to_i/x end

#coerce(x) ⇒ Object

Become 0 in mathematical operations.



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

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

#inspectObject

“void”



175
176
177
# File 'lib/null.rb', line 175

def inspect
  'void'
end