Class: ProgressBar::RunningAverageCalculator

Inherits:
Object
  • Object
show all
Defined in:
lib/progress_bar/running_average_calculator.rb

Class Method Summary collapse

Class Method Details

.calculate(current_average, new_value_to_average, smoothing_factor) ⇒ Object



3
4
5
# File 'lib/progress_bar/running_average_calculator.rb', line 3

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