From: Yochen Gutmann Date: 2006-08-07T00:52:40+09:00 Subject: Re: How to react on nil or wrong object-type as parameter > > def foo(obj) > unless obj.respond_to? :to_str > raise ArgumentError, "argument must be a string" > end > > str = obj.to_str > > ... > end I see, but if it is a long method I might end up with unless obj.respond_to? :to_str,:another_method, :yet_another_method, :and_again_another_method and so on. This seems to be one of the only ways to make it secure. Another way would be to wrap a begin/rescue around the whole method-body to capture all possibly arrising ArgumentErrors. Am I right with this? Ahoi, Yochen -- Posted via http://www.ruby-forum.com/.