123456789_123456789_123456789_123456789_123456789_

Class: Rake::ThreadHistoryDisplay

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: lib/rake/thread_history_display.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(stats) ⇒ ThreadHistoryDisplay

[ GitHub ]

  
# File 'lib/rake/thread_history_display.rb', line 11

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

Instance Method Details

#rename(hash, key, renames) (private)

[ GitHub ]

  
# File 'lib/rake/thread_history_display.rb', line 35

def rename(hash, key, renames)
  if hash && hash[key]
    original = hash[key]
    value = renames[original]
    unless value
      value = renames[:_seq_]
      renames[:_seq_] = renames[:_seq_].succ
      renames[original] = value
    end
    hash[key] = value
  end
end

#show

[ GitHub ]

  
# File 'lib/rake/thread_history_display.rb', line 17

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