Class: OpenPull::Table

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.rewind!Object



8
9
10
# File 'lib/openpull/table.rb', line 8

def rewind!
  print "\r"
end

.show(sub_tables) ⇒ Object



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

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