Skip to content

Instantly share code, notes, and snippets.

@Shinpeim
Created March 4, 2014 06:41
Show Gist options
  • Save Shinpeim/9341435 to your computer and use it in GitHub Desktop.
Save Shinpeim/9341435 to your computer and use it in GitHub Desktop.
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