Class: ProgressBar::Components::Time

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-progressbar/components/time.rb

Constant Summary collapse

TIME_FORMAT =
'%02d:%02d:%02d'
OOB_TIME_FORMATS =
[:unknown, :friendly, nil]
OOB_LIMIT_IN_HOURS =
99
OOB_UNKNOWN_TIME_TEXT =
'??:??:??'
OOB_FRIENDLY_TIME_TEXT =
'> 4 Days'
NO_TIME_ELAPSED_TEXT =
'--:--:--'
ESTIMATED_LABEL =
' ETA'
ELAPSED_LABEL =
'Time'

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Time

Returns a new instance of Time.



16
17
18
19
20
# File 'lib/ruby-progressbar/components/time.rb', line 16

def initialize(options = {})
  self.out_of_bounds_time_format = options[:out_of_bounds_time_format]
  self.timer                     = options[:timer]
  self.progress                  = options[:progress]
end

Instance Method Details

#elapsed_with_labelObject



26
27
28
# File 'lib/ruby-progressbar/components/time.rb', line 26

def elapsed_with_label
  "#{ELAPSED_LABEL}: #{elapsed}"
end

#estimated_with_labelObject



22
23
24
# File 'lib/ruby-progressbar/components/time.rb', line 22

def estimated_with_label
  "#{ESTIMATED_LABEL}: #{estimated}"
end