Skip to content

Instantly share code, notes, and snippets.

@tit
Created Jun 1, 2017
Embed
What would you like to do?
To toss a coin and execute the code ... or not ...
# execute yield or not
# @return [Mixed]
# @example coin { Hamlet.new.to_be }
def coin
yield if [true, false].sample
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment