Sha256: 3f21b7a2296c60dbf8556ce335b99102ae2c545997ef88cfe9954977cd3acdaf
Contents?: true
Size: 462 Bytes
Versions: 1
Compression:
Stored size: 462 Bytes
Contents
require "issa_wrap/version" module IssaWrap class Error < StandardError; end class Wrapper def self.wrap(string, column) return "" if string.nil? || string.empty? return string if string.length <= column where_to_break = string[0...column].index(" ") || column wrapped = string[0...where_to_break] remainder = string[where_to_break..-1] || "" (wrapped + "\n" + wrap(remainder.strip, column)).strip end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
issa_wrap-0.1.0 | lib/issa_wrap.rb |