Class: Hashira::Report::HotspotTable

Inherits:
Object
  • Object
show all
Defined in:
lib/hashira/report/hotspot_table.rb

Constant Summary collapse

TOP =
10
HEADERS =
%w[file Cog Dup Churn Rank].freeze

Instance Method Summary collapse

Constructor Details

#initialize(hotspots, top: TOP, io: $stdout) ⇒ HotspotTable

Returns a new instance of HotspotTable.



7
8
9
10
11
# File 'lib/hashira/report/hotspot_table.rb', line 7

def initialize(hotspots, top: TOP, io: $stdout)
  @hotspots = hotspots
  @top = top
  @io = io
end

Instance Method Details



13
14
15
16
17
18
# File 'lib/hashira/report/hotspot_table.rb', line 13

def print
  return if ranked.empty?
  @io.puts("Hotspots — cost × churn (where refactoring pays the most):\n\n")
  Hashira::Report::Columns.new(HEADERS, ranked.map(&:cells), io: @io).print
  legend
end