
class Object

  # Tests to see if something has value. An object
  # is considered to have value if it is not nil?
  # and if it responds to #empty?, i snot.
  #
  def val?
    return false if nil?
    return false if empty? if respond_to?(:empty?)
    true
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCKernel < Test::Unit::TestCase

    def test_val_1
      f = nil
      t = 1
      assert( ! f.val? )
      assert( t.val? )
    end

    def test_val_2
      f = []
      t = [1]
      assert( ! f.val? )
      assert( t.val? )
    end

    def test_val_3
      f = ''
      t = '1'
      assert( ! f.val? )
      assert( t.val? )
    end

  end

=end
