#--
# As suggested by Ara T. Howard
#++

module Kernel

  # Returns true is an object is class TrueClass,
  # otherwise false.
  #
  #   true.true?   #=> true
  #   false.true?  #=> false
  #   nil.true?    #=> false
  #
  def true?
    (true == self)
  end

  # Returns true is an object is class FalseClass,
  # otherwise false.
  #
  #   true.false?   #=> false
  #   false.false?  #=> true
  #   nil.false?    #=> false
  #
  def false?
    (false == self)
  end

  # Returns true is an object is class TrueClass
  # or FalseClass, otherwise false.
  #
  #   true.bool?   #=> true
  #   false.bool?  #=> true
  #   nil.bool?    #=> false
  #
  def bool?
    (true == self or false == self)
  end

end



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

  require 'test/unit'

  class TCKernel < Test::Unit::TestCase

    def test_false?
      assert( false.false? )
      assert( (1 == 2).false? )
      assert( ! (1 == 1).false? )
    end

    def test_true?
      assert( true.true? )
      assert( (1 == 1).true? )
      assert( ! (1 == 2).true? )
    end

    def test_bool?
      assert_equal( true, true.bool? )
      assert_equal( true, false.bool? )
      assert_equal( false, nil.bool? )
      assert_equal( false, 0.bool? )
    end

  end

=end
