Created
June 1, 2017 12:49
-
-
Save tit/afc195ccb38ca1f17916bdce7a68d2a0 to your computer and use it in GitHub Desktop.
To toss a coin and execute the code ... or not ...
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
# 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