NullClass
NullClass is essentially NilClass but it differs in one important way. When a method is called against it that it deoesn’t have, it will simply return null value rather then raise an error.
Methods
Public Class methods
[ show source ]
# File lib/facets/more/nullclass.rb, line 31 def new @null ||= NullClass.allocate end
Public Instance methods
[ show source ]
# File lib/facets/more/nullclass.rb, line 38 def [](key); nil; end
[ show source ]
# File lib/facets/more/nullclass.rb, line 35 def inspect ; 'null' ; end
[ show source ]
# File lib/facets/more/nullclass.rb, line 39 def method_missing(sym, *args) return nil if sym.to_s[-1,1] == '?' self end
[ show source ]
# File lib/facets/more/nullclass.rb, line 36 def nil? ; true ; end
[ show source ]
# File lib/facets/more/nullclass.rb, line 37 def null? ; true ; end