Created
November 7, 2016 09:54
-
-
Save tagomoris/4cc038b544e0413ab9c532f50818c5b8 to your computer and use it in GitHub Desktop.
variable not assigned by errors is nil.
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
def foo | |
raise "yay" | |
end | |
def hoge | |
tag = foo | |
rescue => e | |
{tag: tag, e: e} | |
end | |
hoge #=> {:tag=>nil, :e=>#<RuntimeError: yay>} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment