Created
July 9, 2014 16:18
-
-
Save tompave/ebb1fb522cb12ed8c097 to your computer and use it in GitHub Desktop.
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
module SendMethodList | |
def send_method_list(*methods) | |
results = methods.map do |sym| | |
begin | |
self.send(sym) | |
rescue => error | |
error | |
end | |
end | |
end | |
end | |
Object.send :include, SendMethodList | |
=begin | |
"Hello".send_method_list :to_sym, :upcase, :foobar | |
=> [:Hello, | |
"HELLO", | |
#<NoMethodError: undefined method `foobar' for "Hello":String>] | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment