From: Peter Lane Date: 2011-12-01T21:03:46+09:00 Subject: Re: errors with respond_to? and inject Sébastien M. wrote in post #1034503: > Quick question though > > Why don(t u need the 'respond_to?' method > We still have to check if object has a price method in order to return > nil > if not. Or is there something i missed? You need respond_to? if you may pass in a non-Item instance to be added to an Item (or rather, as this is Ruby, an instance which does not respond to the 'price' method). Myself, I would try not to do that, but that depends on the design of the rest of your program. -- Posted via http://www.ruby-forum.com/.