Module: RSpeed::Reporter

Defined in:
lib/rspeed/reporter.rb

Class Method Summary collapse

Class Method Details

.callObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rspeed/reporter.rb', line 9

def call
  diff = RSpeed::Differ.final_diff

  print_table(
    headings: %w[Global Value],

    rows: [
      ['Actual Time', diff[:actual_time]],
      ['Removed Time', diff[:removed_time]],
      ['Added Time', diff[:added_time]],
    ]
  )
end


23
24
25
26
27
28
29
30
31
32
# File 'lib/rspeed/reporter.rb', line 23

def print_files(items)
  total_specs = items.size
  headings    = ["#{total_specs} specs", "Pipe #{RSpeed::Env.pipe}/#{RSpeed::Env.pipes}", 'Last Time']

  rows = items.map.with_index do |item, index|
    [format('%02d', index + 1), item[:file], item[:time].to_s]
  end

  print_table(headings: headings, rows: rows)
end


34
35
36
# File 'lib/rspeed/reporter.rb', line 34

def print_table(headings:, rows:)
  puts(Terminal::Table.new(headings: headings, rows: rows, title: 'RSpeed'))
end