From: Dave Thomas Date: 2002-07-25T22:20:32+09:00 Subject: Re: [PATCH] object.c ruby.h (fwd) GOTO Kentaro writes: > > I'd expect to be able to test it with an assert(), but currently I > > can't without writing extra (and distracting) stuff. > > Indeed assert() of Test::Unit::Assertions does not test true/false. > I think that the assert() is too generic and that can blur the meaning > of an assertion. Perhaps true-false-test may prevent abuse of > assert() in rubyunit. Hmm - I differ here. I'd expect assert() to work the same way as 'if' and 'unless' do, so that assert(x) would succeed and fail the same as raise "assertion failed" unless x > Something built-in to get truth value of each object may help explain > the boolean aspect in Ruby. > > % ruby -e ' > module Kernel > def truth() !!self end > end Perhaps #to_b? (But then we'd need a Boolean type for the name to make sense... :)) Dave