So Jordan, how come you chose to go the methods.include? route instead
of the traditional respond_to? approach? I'm in favor of the
respond_to? approach because it allows an object to say what it
responds to (perhaps via some handing in method_missing) that isn't in
its method list. What's your take on it?
So basically, this is the respond_to? approach I'm referring to:
class Array
def all_respond_to?(meth)
all? {|e| e.respond_to?(meth)}
end
end
Which, now that I think about it, in practice doesn't save you much,
as these two lines are almost identical:
puts objs.all? {|e| e.respond_to?(:length)}
puts objs.all_respond_to?(:length)
I personally don't do this type of thing frequently enough to make a
method out of it.
Just my 2 cents.
Dan
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby