Class: ArithmeticMean

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

Class Method Summary collapse

Class Method Details

.average(array_of_numbers) ⇒ Object



4
5
6
7
# File 'lib/ArithmeticMean.rb', line 4

def self.average(array_of_numbers)
  return 0 if array_of_numbers.empty?
  array_of_numbers.sum.to_f / array_of_numbers.size
end