class Chronicle::ETL::Utils::ProgressBar
Constants
- FORMAT_WITHOUT_TOTAL
- FORMAT_WITH_TOTAL
Public Class Methods
new(title: 'Loading', total:)
click to toggle source
# File lib/chronicle/etl/utils/progress_bar.rb, line 40 def initialize(title: 'Loading', total:) opts = { clear: true, complete: '▓'.light_blue, incomplete: '░'.blue, frequency: 10 } if total opts[:total] = total format_str = "#{title} #{FORMAT_WITH_TOTAL}" @pbar = TTY::ProgressBar.new(FORMAT_WITH_TOTAL, opts) else format_str = "#{title} #{FORMAT_WITHOUT_TOTAL}" opts[:no_width] = true end @pbar = TTY::ProgressBar.new(format_str, opts) @pbar.resize end
Public Instance Methods
finish()
click to toggle source
# File lib/chronicle/etl/utils/progress_bar.rb, line 70 def finish @pbar.finish end
increment()
click to toggle source
# File lib/chronicle/etl/utils/progress_bar.rb, line 62 def increment @pbar.advance(1) end
log(message)
click to toggle source
# File lib/chronicle/etl/utils/progress_bar.rb, line 66 def log(message) @pbar.log message end