Sha256: 316e4177206576d49fa8a8035228501ecad43225215a06359f841c91187dc2d2

Contents?: true

Size: 1.11 KB

Versions: 374

Compression:

Stored size: 1.11 KB

Contents

require 'rake/private_reader'

module Rake

  class ThreadHistoryDisplay    # :nodoc: all
    include Rake::PrivateReader

    private_reader :stats, :items, :threads

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

    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

    private

    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
  end

end

Version data entries

374 entries across 321 versions & 82 rubygems

Version Path
mercadopago-custom-checkout-0.2.0 .gs/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.9 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.6 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
lotrd-0.1.9 vendor/cache/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
lotrd-0.1.8 vendor/cache/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
lotrd-0.1.6 vendor/cache/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
lotrd-0.1.5 vendor/cache/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.5 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.4 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.3 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.2 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.1 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
video_chat_get-0.1.0 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
josufst_palindrome-0.2.0 vendor/cache/gems/rake-10.5.0/lib/rake/thread_history_display.rb
josufst_palindrome-0.2.0 vendor/cache/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
josufst_palindrome-0.1.1 vendor/cache/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
josufst_palindrome-0.1.1 vendor/cache/gems/rake-10.5.0/lib/rake/thread_history_display.rb
nlmt-wrappers-0.0.1 vendor/bundle/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
jscop-0.1.2 vendor/cache/ruby/2.6.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/rake-10.5.0/lib/rake/thread_history_display.rb