Top Level Namespace
Defined Under Namespace
Modules: CommandLine, RequestLogAnalyzer Classes: DatabaseConsole, Request
Instance Method Summary collapse
Instance Method Details
#wordwrap(string, max = 80, indent = '') ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cli/database_console_init.rb', line 12 def wordwrap(string, max = 80, indent = '') strings = [''] string.split(', ').each do |item| if strings.last.length == 0 || strings.last.length + item.length <= max strings.last << item << ', ' else strings << (item + ', ') end end strings.map(&:strip).join("\n#{indent}").slice(0..-2) end |