Skip to content

Instantly share code, notes, and snippets.

@tompave
Created July 9, 2014 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tompave/ebb1fb522cb12ed8c097 to your computer and use it in GitHub Desktop.
Save tompave/ebb1fb522cb12ed8c097 to your computer and use it in GitHub Desktop.
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