Method: Bundler::Thor::Shell::TablePrinter#print

Defined in:
lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb', line 18

def print(array)
  return if array.empty?

  prepare(array)

  print_border_separator if options[:borders]

  array.each do |row|
    if options[:borders] && row == BORDER_SEPARATOR
      print_border_separator
      next
    end

    sentence = "".dup

    row.each_with_index do |column, index|
      sentence << format_cell(column, row.size, index)
    end

    sentence = truncate(sentence)
    sentence << "|" if options[:borders]
    stdout.puts indentation + sentence

  end
  print_border_separator if options[:borders]
end