From: Gavin Sinclair Date: 2003-01-17T11:31:37+09:00 Subject: Re: quick: it responds, it evaluates, and is not empty On Friday, January 17, 2003, 12:35:32 PM, dblack wrote: > I continue to dislike the repetition of the > if obj.respond_to?(:meth) then obj.meth ... > thing, although I don't know how to circumvent it efficiently and > effectively. begin obj.meth rescue NameError "Well, I guess we're stuffed, then." end I remember you doing this in dbdbd, and I thought it was quite elegant. I used it once to handle a nil argument in place of something that responds to :to_h hash = begin arg.to_h rescue NameError {} end I wanted to do hash = arg.to_h rescue {} but that doesn't work. Gavin