Class: Array

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

Overview

Hash

Instance Method Summary collapse

Instance Method Details

#meanObject

return the arithmetic mean of the elements in the array. Requires the array to contain only objects of class Fixnum. If any other class is encountered, an error will be raised.



57
58
59
# File 'lib/biopsy/base_extensions.rb', line 57

def mean
  self.inject(0, :+) / self.size.to_f
end