Class NullClass
In: lib/facets/supplemental/facets/nullclass.rb
Parent: Object

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.

TODO: Perhaps NullClass should be called NackClass?

Methods

[]   inspect   method_missing   new   nil?   null?  

Public Class methods

[Source]

# File lib/facets/supplemental/facets/nullclass.rb, line 12
    def new
      @null ||= NullClass.allocate
    end

Public Instance methods

[Source]

# File lib/facets/supplemental/facets/nullclass.rb, line 19
  def [](key); nil; end

[Source]

# File lib/facets/supplemental/facets/nullclass.rb, line 16
  def inspect ; 'null' ; end

[Source]

# File lib/facets/supplemental/facets/nullclass.rb, line 20
  def method_missing(sym, *args)
    return nil if sym.to_s[-1,1] == '?'
    self
  end

[Source]

# File lib/facets/supplemental/facets/nullclass.rb, line 17
  def nil?  ; true ; end

[Source]

# File lib/facets/supplemental/facets/nullclass.rb, line 18
  def null? ; true ; end

[Validate]