lib/bumbler/stats.rb in bumbler-0.5.0 vs lib/bumbler/stats.rb in bumbler-0.6.0

- old
+ new

@@ -1,29 +1,31 @@ +# frozen_string_literal: true module Bumbler module Stats class << self - def tracked_items - Bumbler::Progress.registry.each do |type, items| - puts "Stats for #{type} items:" - - items.to_a.sort_by! {|n,d| d[:time].to_f}.each do |name, info| - if info[:time] - puts ' %s %s' % [('%.2f' % info[:time]).rjust(8), name] - else - puts " pending: #{name}" - end + def print_overview + registry = Bumbler::Progress.registry + puts "#{registry.count { |_n, time| time }} of #{registry.size} gems required" + end + + def print_tracked_items + Bumbler::Progress.registry.sort_by { |_n, time| time.to_f }.each do |name, time| + if time + puts format(' %s %s', ('%.2f' % time).rjust(8), name) + else + puts " pending: #{name}" end end - + self end - - def all_slow_items + + def print_slow_items puts "Slow requires:" - Bumbler::Hooks.slow_requires.to_a.sort_by! {|n,t| t}.each do |name, time| - puts ' %s %s' % [('%.2f' % time).rjust(8), name] + Bumbler::Hooks.slow_requires.to_a.sort_by! { |_n, t| t }.each do |name, time| + puts format(' %s %s', ('%.2f' % time).rjust(8), name) end - + self end end end end