class ProgressBar::Components::Time
Constants
- ELAPSED_LABEL
- ESTIMATED_LABEL
- NO_TIME_ELAPSED_TEXT
- OOB_FRIENDLY_TIME_TEXT
- OOB_LIMIT_IN_HOURS
- OOB_TIME_FORMATS
- OOB_UNKNOWN_TIME_TEXT
- TIME_FORMAT
Attributes
out_of_bounds_time_format[R]
progress[RW]
timer[RW]
Public Class Methods
new(options = {})
click to toggle source
# 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
Public Instance Methods
elapsed_with_label()
click to toggle source
# File lib/ruby-progressbar/components/time.rb, line 26 def elapsed_with_label "#{ELAPSED_LABEL}: #{elapsed}" end
estimated_with_label()
click to toggle source
# File lib/ruby-progressbar/components/time.rb, line 22 def estimated_with_label "#{ESTIMATED_LABEL}: #{estimated}" end
Protected Instance Methods
estimated_with_friendly_oob()
click to toggle source
# File lib/ruby-progressbar/components/time.rb, line 44 def estimated_with_friendly_oob self.out_of_bounds_time_format = :friendly estimated_with_elapsed_fallback end
estimated_with_no_oob()
click to toggle source
# File lib/ruby-progressbar/components/time.rb, line 32 def estimated_with_no_oob self.out_of_bounds_time_format = nil estimated_with_elapsed_fallback end
estimated_with_unknown_oob()
click to toggle source
# File lib/ruby-progressbar/components/time.rb, line 38 def estimated_with_unknown_oob self.out_of_bounds_time_format = :unknown estimated_with_elapsed_fallback end
out_of_bounds_time_format=(format)
click to toggle source
# File lib/ruby-progressbar/components/time.rb, line 54 def out_of_bounds_time_format=(format) unless OOB_TIME_FORMATS.include? format fail 'Invalid Out Of Bounds time format. Valid formats are ' + OOB_TIME_FORMATS.inspect end @out_of_bounds_time_format = format end