Created
August 28, 2012 13:53
-
-
Save patrickwmcgee/3498191 to your computer and use it in GitHub Desktop.
Amazing wordwrap function from https://github.com/cmdrkeene/memegen
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
def word_wrap(txt, col = 80) | |
txt.gsub(/(.{1,#{col + 4}})(\s+|\Z)/, "\\1\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment