Class: ProgressBar::Components::EstimatedTimer
- Inherits:
-
Object
- Object
- ProgressBar::Components::EstimatedTimer
- Includes:
- Progressable, Timer
- Defined in:
- lib/progress_bar/components/estimated_timer.rb
Defined Under Namespace
Classes: As
Constant Summary collapse
- VALID_OOB_TIME_FORMATS =
[:unknown, :friendly, nil]
Constants included from Progressable
Progressable::DEFAULT_BEGINNING_POSITION, Progressable::DEFAULT_SMOOTHING, Progressable::DEFAULT_TOTAL
Constants included from Timer
Instance Attribute Summary
Attributes included from Progressable
#progress, #running_average, #smoothing, #starting_position, #total
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ EstimatedTimer
constructor
A new instance of EstimatedTimer.
- #out_of_bounds_time_format=(format) ⇒ Object
- #reset ⇒ Object
- #start(options = {}) ⇒ Object
- #to_s ⇒ Object
Methods included from Progressable
#decrement, #finish, #increment, #percentage_completed, #percentage_completed_with_precision, #started?
Methods included from Timer
#pause, #resume, #started?, #stop, #stopped?
Constructor Details
#initialize(options = {}) ⇒ EstimatedTimer
Returns a new instance of EstimatedTimer.
9 10 11 |
# File 'lib/progress_bar/components/estimated_timer.rb', line 9 def initialize( = {}) super end |
Instance Method Details
#out_of_bounds_time_format=(format) ⇒ Object
23 24 25 26 27 |
# File 'lib/progress_bar/components/estimated_timer.rb', line 23 def out_of_bounds_time_format=(format) raise "Invalid Out Of Bounds time format. Valid formats are #{VALID_OOB_TIME_FORMATS.inspect}" unless VALID_OOB_TIME_FORMATS.include? format @out_of_bounds_time_format = format end |
#reset ⇒ Object
18 19 20 21 |
# File 'lib/progress_bar/components/estimated_timer.rb', line 18 def reset as(Timer).reset as(Progressable).reset end |
#start(options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/progress_bar/components/estimated_timer.rb', line 13 def start( = {}) as(Timer).start as(Progressable).start() end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/progress_bar/components/estimated_timer.rb', line 29 def to_s " ETA: #{estimated_time}" end |