Class: ProgressBar::Calculators::SmoothedAverage

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-progressbar/calculators/smoothed_average.rb

Class Method Summary collapse

Class Method Details

.calculate(current_average, new_value_to_average, rate) ⇒ Object



4
5
6
# File 'lib/ruby-progressbar/calculators/smoothed_average.rb', line 4

def self.calculate(current_average, new_value_to_average, rate)
  (new_value_to_average * (1.0 - rate)) + (current_average * rate)
end