class ProgressBar::Components::Time
Constants
- ELAPSED_LABEL
- ESTIMATED_LABEL
- NO_TIME_ELAPSED_TEXT
- OOB_FRIENDLY_TIME_TEXT
- OOB_LIMIT_IN_HOURS
- OOB_TEXT_TO_FORMAT
- OOB_TIME_FORMATS
- OOB_UNKNOWN_TIME_TEXT
- TIME_FORMAT
- WALL_CLOCK_FORMAT
Attributes
Public Class Methods
Source
# File lib/ruby-progressbar/components/time.rb, line 21 def initialize(options = {}) self.timer = options[:timer] self.progress = options[:progress] self.projector = options[:projector] end
Public Instance Methods
Source
# File lib/ruby-progressbar/components/time.rb, line 31 def elapsed_with_label "#{ELAPSED_LABEL}: #{elapsed}" end
Source
# File lib/ruby-progressbar/components/time.rb, line 47 def estimated_wall_clock return timer.stopped_at.strftime(WALL_CLOCK_FORMAT) if progress.finished? return NO_TIME_ELAPSED_TEXT unless timer.started? memo_estimated_seconds_remaining = estimated_seconds_remaining return NO_TIME_ELAPSED_TEXT unless memo_estimated_seconds_remaining (timer.now + memo_estimated_seconds_remaining). strftime(WALL_CLOCK_FORMAT) end
Source
# File lib/ruby-progressbar/components/time.rb, line 43 def estimated_with_friendly_oob estimated_with_elapsed_fallback(:friendly) end
Source
# File lib/ruby-progressbar/components/time.rb, line 27 def estimated_with_label(out_of_bounds_time_format = nil) "#{ESTIMATED_LABEL}: #{estimated(out_of_bounds_time_format)}" end
Source
# File lib/ruby-progressbar/components/time.rb, line 35 def estimated_with_no_oob estimated_with_elapsed_fallback(nil) end
Source
# File lib/ruby-progressbar/components/time.rb, line 39 def estimated_with_unknown_oob estimated_with_elapsed_fallback(:unknown) end