Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/string_extensions.rb

Overview

Copyright 2007, LAIKA, Inc. #

#

Authors: #

* Ben Bleything <[email protected]>                    #

Instance Method Summary collapse

Instance Method Details

#wrap(line_width = 72) ⇒ Object



11
12
13
# File 'lib/string_extensions.rb', line 11

def wrap(line_width = 72)
	self.gsub(/\n/, "\n\n").gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip
end