a wrote:
how about simply
obj.respond_to? :read # => true
obj.respond_to? :read, IO # => true
obj.respond_to? :read, IO, Proc # => false
becomes
class Object
def respond_to?(meth, *signature)
# new stuff…
end
endnice and backward compatible. easy to remember.
a good improvement to #respond_to? no doubt, and easily implemented.
but duck_signiture would actually insepect a method to determine the respond_to? requirements of its parameters, which is quite a different sort of beast.
in fact, i think this is a good CHALLENGE FOR ALL RUBYISTS! Implement #duck_signiture in pure Ruby. can you do it!? ![]()
if you become frustrated this is funny:
Dave Barry, humor columnist and author of Insane City
-t0