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
].freeze

Class Method Summary collapse

Class Method Details

.rewind!Object



10
11
12
# File 'lib/openpull/table.rb', line 10

def rewind!
  print "\r"
end

.show(sub_tables) ⇒ Object



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

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.zero? && !j.zero?
        tab.add_row row
      end
    end
  end
end