Created
November 18, 2009 11:34
-
-
Save joho/237759 to your computer and use it in GitHub Desktop.
object#respond_to for mutltiple methods at once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
# sometimes it's handy to know | |
def respond_to_any?(*method_names) | |
method_names.any? { |method_name| respond_to?(method_name) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment