From: David Masover Date: 2008-05-29T07:06:24+09:00 Subject: Re: The duck's backside On Wednesday 28 May 2008 16:25:15 John Carter wrote: > # Raise a DuckTypingException unless the object responds to all symbol. > def quacks_like( *symbols) > symbols.each do |symbol| > raise DuckTypingException, "Duck typing error, expected this object to respond to :#{symbol}, but found class #{self.class}\n\t\t#{symbol.inspect}" unless > respond_to? symbol > end > end Just occurred to me that this does have one flaw: It cannot check for what happens when method_missing is hit. I doubt that's much of a problem in practice, though.