Class: CodeReviewLeaderboard::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/code_review_leaderboard/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(tally) ⇒ Formatter

Returns a new instance of Formatter.



5
6
7
# File 'lib/code_review_leaderboard/formatter.rb', line 5

def initialize(tally)
  @tally = tally
end

Instance Method Details

#to_tableObject



9
10
11
12
13
14
15
# File 'lib/code_review_leaderboard/formatter.rb', line 9

def to_table
  Terminal::Table.new(headings:) do |rows|
    totals.each do |user, reviews|
      rows << [user, reviews[:total], reviews[:approved], reviews[:changes_requested], reviews[:commented]]
    end
  end
end