Method: Wrapword.wrap

Defined in:
lib/wrapword.rb

.wrap(word, limit) ⇒ Object



6
7
8
9
10
11
# File 'lib/wrapword.rb', line 6

def self.wrap(word, limit)
  return word if word.length <= limit
  space = limit
  space = space(word,limit) if space(word,limit) 
  "#{word[0...space]}\n#{wrap(word[space..-1].strip, limit)}"
end