On Mar 27, 2006, at 10:43 AM, listrecv / gmail.com wrote: > That wouldn't be very duckish - I'd still need to explicitly state > which objects are acceptable - the whole point is to leave that up to > the user, as long as the object can do what it needs to, I never need > to hear it's name. > > Just curious, but what happens if you just throw a string at it? str.each { |s| } tends to be str most of the time anyway. alternatively: class Object def scalar? true # or possibly not respond_to? :each end end module Enumerable def scalar? false end end class String def scalar? true end end Thanks to the magic of inheritance it will all work out