vendor/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/shell/basic.rb
# Prints a long string, word-wrapping the text to the current width of the
# terminal display. Ideal for printing heredocs.
#
# ==== Parameters
# String
#
# ==== Options
# ident<Integer>:: Indent each line of the printed paragraph by ident value.
#
Prints a long string, word-wrapping the text to the current width of the
terminal display. Ideal for printing heredocs.

Parameters
String

Options
ident:: Indent each line of the printed paragraph by ident value.
Prints a long string word - wrapping the text to the current width of the terminal display . Ideal for printing heredocs . Parameters String Options ident :: Indent each line of the printed paragraph by ident value .
def print_wrapped(message, options={})
        ident = options[:ident] || 0
        width = terminal_width - ident
        paras = message.split("\n\n")
        paras.map! do |unwrapped|
          unwrapped.strip.gsub(/\n/, " ").squeeze(" ").
          gsub(/.{1,#{width}}(?:\s|\Z)/){($& + 5.chr).
          gsub(/\n\005/,"\n").gsub(/\005/,"\n")}
        end
        paras.each do |para|
          para.split("\n").each do |line|
            $stdout.puts line.insert(0, " " * ident)
          end
          $stdout.puts unless para == paras.last
        end
      end
def print_wrapped ( message , options = { } ) ident = options [ :ident ] || 0 width = terminal_width - ident paras = message . split ( "\n\n" ) paras . map! do | unwrapped | unwrapped . strip . gsub ( / \n / , " " ) . squeeze ( " " ) . gsub ( / .{1, #{ width } }(?: \s | \Z ) / ) { ( $& + 5 . chr ) . gsub ( / \n \005 / , "\n" ) . gsub ( / \005 / , "\n" ) } end paras . each do | para | para . split ( "\n" ) . each do | line | $stdout . puts line . insert ( 0 , " " * ident ) end $stdout . puts unless para == paras . last end end
Prints a long string, word-wrapping the text to the current width of the
terminal display.
Prints a long string word - wrapping the text to the current width of the terminal display .
message
<not_specific>
options
<not_specific>