class ProgressBar::Components::Rate
Attributes
Public Class Methods
Source
# File lib/ruby-progressbar/components/rate.rb, line 8 def initialize(options = {}) self.rate_scale = options[:rate_scale] || lambda { |x| x } self.timer = options[:timer] self.progress = options[:progress] end
Public Instance Methods
Source
# File lib/ruby-progressbar/components/rate.rb, line 14 def rate_of_change(format_string = '%i') return '0' if elapsed_seconds <= 0 format_string % scaled_rate end
Source
# File lib/ruby-progressbar/components/rate.rb, line 20 def rate_of_change_with_precision rate_of_change('%.2f') end