Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/biopsy/base_extensions.rb
Overview
Hash
Instance Method Summary collapse
-
#mean ⇒ Object
return the arithmetic mean of the elements in the array.
Instance Method Details
#mean ⇒ Object
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 |