Module: Omnizip::Progress
- Defined in:
- lib/omnizip/progress.rb,
lib/omnizip/progress/log_reporter.rb,
lib/omnizip/progress/progress_bar.rb,
lib/omnizip/progress/silent_reporter.rb,
lib/omnizip/progress/console_reporter.rb,
lib/omnizip/progress/progress_tracker.rb,
lib/omnizip/progress/callback_reporter.rb,
lib/omnizip/progress/progress_reporter.rb,
lib/omnizip/progress/operation_progress.rb
Overview
Progress tracking module.
This module provides real-time progress tracking for long-running operations with multiple reporting strategies (console, callback, log file, etc.) and integrated ETA calculation.
Defined Under Namespace
Classes: CallbackReporter, Configuration, ConsoleReporter, LogReporter, OperationProgress, ProgressBar, ProgressReporter, ProgressTracker, SilentReporter
Class Method Summary collapse
-
.build_reporters(reporter, block) ⇒ Array<ProgressReporter>
Build reporters from various input formats.
-
.configuration ⇒ Configuration
Get global configuration.
-
.configure {|config| ... } ⇒ Object
Configure global progress settings.
-
.track(total_files:, total_bytes:, reporter: :auto, update_interval: 0.5, eta_strategy: :exponential_smoothing) {|progress| ... } ⇒ ProgressTracker
Track an operation's progress.
Class Method Details
.build_reporters(reporter, block) ⇒ Array<ProgressReporter>
Build reporters from various input formats
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/omnizip/progress.rb', line 91 def self.build_reporters(reporter, block) reporters = [] # Handle callback block reporters << CallbackReporter.new(&block) if block # Handle reporter parameter case reporter when :auto reporters << ConsoleReporter.new if $stdout.tty? when :console reporters << ConsoleReporter.new when :silent reporters << SilentReporter.new when Array reporters.concat(reporter) when ProgressReporter reporters << reporter when Symbol raise ArgumentError, "Unknown reporter type: #{reporter}" end # Default to silent if no reporters reporters << SilentReporter.new if reporters.empty? reporters end |
.configuration ⇒ Configuration
Get global configuration
82 83 84 |
# File 'lib/omnizip/progress.rb', line 82 def self.configuration @configuration ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
Configure global progress settings
75 76 77 |
# File 'lib/omnizip/progress.rb', line 75 def self.configure yield configuration end |
.track(total_files:, total_bytes:, reporter: :auto, update_interval: 0.5, eta_strategy: :exponential_smoothing) {|progress| ... } ⇒ ProgressTracker
Track an operation's progress
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/omnizip/progress.rb', line 58 def self.track(total_files:, total_bytes:, reporter: :auto, update_interval: 0.5, eta_strategy: :exponential_smoothing, &block) reporters = build_reporters(reporter, block) ProgressTracker.new( total_files: total_files, total_bytes: total_bytes, reporters: reporters, update_interval: update_interval, eta_strategy: eta_strategy, ) end |