Class: Bundler::Thor::Shell::WrappedPrinter
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
ColumnPrinter
|
|
Instance Chain:
self,
ColumnPrinter
|
|
Inherits: |
Bundler::Thor::Shell::ColumnPrinter
|
Defined in: | lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb |
Class Method Summary
ColumnPrinter
- Inherited
Instance Attribute Summary
ColumnPrinter
- Inherited
Instance Method Summary
Constructor Details
This class inherits a constructor from Bundler::Thor::Shell::ColumnPrinter
Instance Method Details
#print(message)
[ GitHub ]# File 'lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb', line 7
def print( ) width = Terminal.terminal_width - @indent paras = .split("\n\n") paras.map! do |unwrapped| words = unwrapped.split(" ") counter = words.first.length words.inject do |memo, word| word = word.gsub(/\n\005/, "\n").gsub(/\005/, "\n") counter = 0 if word.include? "\n" if (counter + word.length + 1) < width memo = "#{memo} #{word}" counter += (word.length + 1) else memo = "#{memo}\n#{word}" counter = word.length end memo end end.compact! paras.each do |para| para.split("\n").each do |line| stdout.puts line.insert(0, " " * @indent) end stdout.puts unless para == paras.last end end