Created
April 11, 2017 01:49
-
-
Save madogiwa0124/7ec088eafe62c517dcaf2177b51cfdd2 to your computer and use it in GitHub Desktop.
Twitterで話題になってた条件分岐の件を実装してみた。
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
hasA, hasB, hasC = true, false, true | |
cmd = ["foo"] | |
cmd << "-a AAA" if hasA | |
cmd << "-b BBB" if hasB | |
cmd << "-c CCC" if hasC | |
puts cmd.join(" ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment