Class: ProgressBar::Calculators::RunningAverage

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

Class Method Summary collapse

Class Method Details

.calculate(current_average, new_value_to_average, smoothing_factor) ⇒ Object



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

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