Created
April 4, 2014 19:12
-
-
Save rubypanther/9981233 to your computer and use it in GitHub Desktop.
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
class String | |
def to_len_lines(len=80) | |
self.dup.to_len_lines!(len) | |
end | |
def to_len_lines!(len=80) | |
((self.length/len.to_f).ceil).times{|i| self[i*len,0] = $/ } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment