Class: Rake::ThreadHistoryDisplay

Inherits:
Object
  • Object
show all
Includes:
PrivateReader
Defined in:
lib/rake/thread_history_display.rb

Overview

:nodoc: all

Instance Method Summary collapse

Methods included from PrivateReader

included

Constructor Details

#initialize(stats) ⇒ ThreadHistoryDisplay

Returns a new instance of ThreadHistoryDisplay.



10
11
12
13
14
# File 'lib/rake/thread_history_display.rb', line 10

def initialize(stats)
  @stats   = stats
  @items   = { :_seq_ =>  1  }
  @threads = { :_seq_ => "A" }
end

Instance Method Details

#showObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rake/thread_history_display.rb', line 16

def show
  puts "Job History:"
  stats.each do |stat|
    stat[:data] ||= {}
    rename(stat, :thread, threads)
    rename(stat[:data], :item_id, items)
    rename(stat[:data], :new_thread, threads)
    rename(stat[:data], :deleted_thread, threads)
    printf("%8d %2s %-20s %s\n",
      (stat[:time] * 1_000_000).round,
      stat[:thread],
      stat[:event],
      stat[:data].map do |k, v| "#{k}:#{v}" end.join(" "))
  end
end