Class InvalidNackError
In: lib/facet/nack.rb
Parent: ArgumentError

Description

The NackClass is is like the NilClass except one step down. Nack is never used to to mean nothingness or emptiness. The Nack class is only used to report something is "a miss" w/o the system raising an Exception. It’s a mechanism for lazy error evaluation.

Usage

  def scalar( x )
    if x.kind_of?(Enumerable)
      return nack(ArgumentError, "Value must not be enumerable")
    end
    x
  end

  a = scaler( 1 )            #=> 1
  b = scaler( [1,2] )        #=> nack
  b.first                    #=> ArgumentError (previous)

  a = nail scaler( 1 )       #=> 1
  b = nail scaler( [1,2] )   #=> ArgumentError

Author(s)

  • Thomas Sawyer

[Validate]