Sha256: 829a174008b6fe814b61abe1becbe0dc6fc53e1905f24372dfc75a072c7f5f81
Contents?: true
Size: 306 Bytes
Versions: 1
Compression:
Stored size: 306 Bytes
Contents
#!/usr/bin/env ruby # wrap.rb # yesmar@speakeasy.net module Wrap DEFAULT_COLUMNS=78 # variable-length word wrap def wrap(columns=DEFAULT_COLUMNS) self.gsub(/\n/, ' ').gsub(/.{1,#{columns}}(?:\s|\Z)/){$&+"\n"} end end raise RuntimeError, 'This library is for require only' if $0 == __FILE__
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rex-0.0.4 | lib/rex/modules/wrap.rb |