Sha256: 0302412527e56036539759307ea2ded8c68b794a0eb8b00c804d12595eaa85ee

Contents?: true

Size: 1.13 KB

Versions: 6982

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true
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

6,982 entries across 6,870 versions & 99 rubygems

Version Path
cybrid_api_id_ruby-0.122.67 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_bank_ruby-0.122.66 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_organization_ruby-0.122.66 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_id_ruby-0.122.66 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_id_ruby-0.122.65 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_bank_ruby-0.122.65 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_organization_ruby-0.122.65 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_bank_ruby-0.122.64 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_id_ruby-0.122.64 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_organization_ruby-0.122.64 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
direct7-0.0.18 vendor/bundle/ruby/3.0.0/gems/rake-13.1.0/lib/rake/thread_history_display.rb
direct7-0.0.18 vendor/bundle/ruby/2.7.0/gems/rake-13.1.0/lib/rake/thread_history_display.rb
direct7-0.0.17 vendor/bundle/ruby/2.7.0/gems/rake-13.1.0/lib/rake/thread_history_display.rb
direct7-0.0.17 vendor/bundle/ruby/3.0.0/gems/rake-13.1.0/lib/rake/thread_history_display.rb
cybrid_api_id_ruby-0.122.60 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_bank_ruby-0.122.60 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_organization_ruby-0.122.60 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_organization_ruby-0.122.59 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_bank_ruby-0.122.59 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb
cybrid_api_id_ruby-0.122.59 vendor/bundle/ruby/3.3.0/gems/rake-13.0.6/lib/rake/thread_history_display.rb