Class: GitFame::Render

Inherits:
Base
  • Object
show all
Defined in:
lib/git_fame/render.rb,
lib/git_fame/render/extension.rb

Defined Under Namespace

Modules: Extension

Constant Summary collapse

FIELDS =
[:name, :email, :lines, :commits, :files, :dist].map(&:to_s).freeze

Instance Method Summary collapse

Instance Method Details

#callvoid

This method returns an undefined value.

Renders to stdout



21
22
23
24
25
26
27
28
29
30
# File 'lib/git_fame/render.rb', line 21

def call
  table = TTY::Table.new(header: FIELDS)
  width = TTY::Screen.width

  contributions.reverse_each do |c|
    table << [c.name, c.email, c.lines.f, c.commits.count.f, c.files.count.f, c.dist(self)]
  end

  print table.render(:unicode, width:, resize: true, alignment: [:center])
end