
class Object
  def to_bool
    return true
  end
end

class TrueClass
  def to_bool
    self
  end
end

class FalseClass
  def to_bool
    self
  end
end

class NilClass
  def to_bool
    false
  end
end


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

  require 'test/unit'

  class TCKernel < Test::Unit::TestCase

    def test_to_bool
      assert_equal( true, true.to_bool )
      assert_equal( false, false.to_bool )
      assert_equal( false, nil.to_bool )
    end

  end

=end
