From: Robert Dober Date: 2009-04-23T02:44:24+09:00 Subject: Re: how to test for existence of a method On Wed, Apr 22, 2009 at 7:34 PM, Tom Cloyd wrote: > > How would you do this? Well by mirroring the logic of method_missing two cases were this can be done simply def method_missing *args, &blk delegation.send *args, &blk end def respond_to? name delegation.respond_to? name end ------- def method_missing *args, &blk fetch( args.first.to_sym ){ super } # déjà vu ;) end def respond_to? name has_key name.to_sym end ========================== Jesus' question was shall one do this, I believe that more often than not one shall indeed do this. Robert's warning remains very valuable though, because I believe that very often one does not go through the trouble. Cheers Robert