Skip to content

Instantly share code, notes, and snippets.

@rubypanther
Created April 4, 2014 19:12
Show Gist options
  • Save rubypanther/9981233 to your computer and use it in GitHub Desktop.
Save rubypanther/9981233 to your computer and use it in GitHub Desktop.
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