Method: UI.wrapped
- Defined in:
- lib/ruby_doc/cli/ui.rb
.wrapped(s, width = 60) ⇒ Object
currently not being used
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/ruby_doc/cli/ui.rb', line 481 def self.wrapped(s, width=60) lines = [] line = "" s.split(/\s+/).each do |word| if line.size + word.size >= width lines << line line = word elsif line.empty? line = word else line << " " << word end end lines << line if line return lines.join "\n" end |