Sha256: 30081fa9ac189ed31cec5fa17eaf0e6dea7eef2c50c3242fee17ac3b803e6c61

Contents?: true

Size: 1.1 KB

Versions: 90

Compression:

Stored size: 1.1 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

90 entries across 83 versions & 19 rubygems

Version Path
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
cloudsmith-api-0.30.7 vendor/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
color_me_shop-1.0.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/rake-12.0.0/lib/rake/thread_history_display.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb