Class: OpenPull::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/openpull/table.rb

Constant Summary collapse

HEADINGS =
%w(title user labels status mergeable url updated)

Class Method Summary collapse

Class Method Details

.rewind!Object



6
7
8
# File 'lib/openpull/table.rb', line 6

def rewind!
  print "\r"
end

.show(sub_tables) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/openpull/table.rb', line 10

def show(sub_tables)
  rewind!

  Terminal::Table.new(headings: HEADINGS.map(&:bold)) do |tab|
    sub_tables.each_with_index do |sub_table, j|
      sub_table.each_with_index do |row, i|
        tab.add_separator if i == 0 && j != 0
        tab.add_row row
      end
    end
  end
end