Class: ProgressBar
Instance Method Summary collapse
-
#initialize(max) ⇒ ProgressBar
constructor
A new instance of ProgressBar.
- #render_bar(current, length) ⇒ Object
- #report_progress(progress) ⇒ Object
Methods inherited from Progress
#print_line, #update_last_line
Constructor Details
#initialize(max) ⇒ ProgressBar
Returns a new instance of ProgressBar.
22 23 24 |
# File 'lib/progress.rb', line 22 def initialize(max) @max = max.to_f end |
Instance Method Details
#render_bar(current, length) ⇒ Object
26 27 28 29 |
# File 'lib/progress.rb', line 26 def (current, length) = (current.to_f * length.to_f).floor "=" * + ">" + " " * (length - ) end |
#report_progress(progress) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/progress.rb', line 31 def report_progress(progress) if progress then current = (progress.to_f / @max) update_last_line("[#{(current, 40)}] combinations covered: #{progress}/#{@max} (#{format("%.8f", current * 100.0)}%)") else update_last_line("[... ? ... ? ... ? ...] combinations covered: ?/∞ (?%)") end end |