Sha256: 2a1488344ba9c4bf008c517c1364444614e55aad93390876b3a7702d4fc76b32

Contents?: true

Size: 209 Bytes

Versions: 12

Compression:

Stored size: 209 Bytes

Contents

class String
  def wrap(width)
    split("\n").collect { |line|
      if line.length > width
        line.gsub(/(.{1,#{width}})(\s+|$)/, "\\1\n").strip
      else
        line
      end
    } * "\n"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
tp-0.7.0 lib/string.rb
tp-0.7.0pre2 lib/string.rb
tp-0.7.0pre1 lib/string.rb
tp-0.6.2 lib/string.rb
tp-0.6.2pre2 lib/string.rb
tp-0.6.2pre1 lib/string.rb
tp-0.6.1 lib/string.rb
tp-0.6.0 lib/string.rb
tp-0.5.1 lib/string.rb
tp-0.5.0 lib/string.rb
tp-0.4.1 lib/string.rb
tp-0.4.0 lib/string.rb