respond_to?
is an awesome method for testing if an object has a given method. By default, it will return false for methods that are private. If you want to test if an object has a method regardless of its private status, you can just pass true after the method name:
respond_to?(:foo, true)
No comments:
Post a Comment