Trans wrote:

>   if foo
> 
> How does 'foo' tell 'if' it's not truth-ful?

It uses the RTEST() macro which currently checks if the object is either 
nil or false in a very fast way.

There has been requests for making RTEST() call a method on objects if 
it has been defined to get the truth state -- I'm one of the people who 
would like to see it and suggested using Object#to_bool -- however, so 
far the feature has been too obscure to cause a performance decrease. 
(Some time ago matz said that it could slow down Ruby quite a bit.)

I guess the best way of getting this into Ruby itself is to write a 
patch, optimize the heck out of it and send it to the friendly folks at 
from the ruby-core mailing list -- then fix the thousand bugs that Nobu 
will find in your code and resubmit. ;)