Created
March 4, 2014 06:41
-
-
Save Shinpeim/9341435 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 Collision < StandardError; end | |
def generate_random_string | |
raise Collision; | |
end | |
def nyan(retries = 10) | |
s = generate_random_string | |
rescue Collision => e | |
p "コリジョンが発生しました" | |
nyan(retries - 1) if retries > 0 | |
end | |
s = nyan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment