Last active
February 1, 2018 02:32
-
-
Save phluid61/2932b6ab714a9e01e049cc6dcecb32bb to your computer and use it in GitHub Desktop.
The best way to generate strings in Ruby...
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
# A Percent character '%' | |
eval '% %s %% % ' | |
# (wrapped in `eval` to highlight the trailing space, which is critical) | |
# A Question-mark character '?' | |
%?%s?%?? | |
# A Hash character '#' | |
%{#{%##%%##}#} | |
# BONUS: '??' | |
%{#{%?#{??}?}#{%?#{??}?}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment