Hello --

On Mon, 18 Feb 2002, David Corbin wrote:

> When I say:
>
> "if (x =~ /pat/)" everything is OK.  When I trty to pass this
> expression as an argument to a method expecting TrueClass or
> FalseClass, I get a problem.  I assume that this expression is an
> Array of "backreferences".  Is this correct?  If so, how can
> "coerce" this to be a boolean as one uses in the if.?

It actually returns the position in the string where the match
starts, or nil if there's no match.  If you wanted it to return
true or false (but not nil), I guess you could do:

  (x =~ /pat/) && true || false

Or could you get your class to recognize more general true/false
equivalences?  Or is there some nicer/shorter way to do it
I'm not thinking of? :-)


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav