Hi --

On Fri, 17 Jan 2003 dblack / candle.superlink.net wrote:

> Hi --
>
> On Fri, 17 Jan 2003, Tom Sawyer wrote:
>
> > On Thursday 16 January 2003 11:25 pm, Bulat Ziganshin wrote:
> > >
> > > ((not ameth.to_s.empty?) and ...) rescue 0
> >
>
> > thanks, this seems the most concise answer
>
> However, it doesn't do what you originally were doing.  false.to_s is
> "false" (not an empty string), so only testing ameth.to_s.empty? is
> not the same as testing ameth for truth separately from testing
> ameth.to_s for emptiness.

I should add: it also doesn't duplicate the respond_to? functionality,
because an exception might be raised by something other than there
beign no ameth method (such as division by zero in #ameth).


David

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