Hi --

On Sat, 5 Jun 2004, Gregory Millam wrote:

> Received: Sat, 5 Jun 2004 03:34:47 +0900
> And lo, Edgardo wrote:
> 
> > Hi, everybody. I would like to use an assert like function to test the 
> > number of rows returned by a query. Something like Eiffel's
> > 
> > check result.num_rows = 1
> > 
> > What's the best way to do that in Ruby?
> > 
> 
> result.num_rows == 1 or raise "num_rows is not 1"
> 
> is equivalent to
> 
> raise "num_rows is not 1" unless result.num_rows == 1
> 
> The 'or/and' method is idiomatic, while the 'if/unless' is more readable.

I didn't know idioms had to be unreadable :-))


David

-- 
David A. Black
dblack / wobblini.net