Sha256: 1e150a4ade4da0bb16181bcc11a2a2dc283deb3f53b616e97fd6d70846e2dbfc
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
require 'forwardable' module Fasten module UI class Console extend Forwardable def_delegators :runner, :workers, :tasks def_delegators :runner, :name, :jobs, :jobs=, :state, :state=, :hformat attr_accessor :runner def initialize(runner:) @runner = runner @old_done = [] @old_failed = [] end def setup puts <<~FIN = == === ==== ===== ====== ======= ======== ========= ========== Fasten your seatbelts! #{'💺' * jobs} #{runner.use_threads ? 'threads' : 'processes'} #{name} FIN $stdout.sync = true @setup_done = true end def update setup unless @setup_done display_task_message(tasks.done, @old_done, 'Done in') display_task_message(tasks.failed, @old_failed, 'Fail in') end def cleanup puts '========== ========= ======== ======= ====== ===== ==== === == =' @setup_done = false end def force_clear; end protected def display_task_message(orig, old, message) return unless old.count != orig.count (orig - old).each do |task| puts "Time: #{hformat Time.new - runner.ini} #{message} #{hformat task.dif} #{task.worker} Task #{task}" old << task end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fasten-0.14.4 | lib/fasten/ui/console.rb |
fasten-0.14.2 | lib/fasten/ui/console.rb |
fasten-0.14.0 | lib/fasten/ui/console.rb |