Created
August 16, 2013 04:00
-
-
Save banderson623/6247204 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
def try_or_else(method_name,else_thing) | |
return self.public_send(method_name) | |
rescue NoMethodError | |
return else_thing | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment