Method: Utilities::Statistics#sum
- Defined in:
- lib/utilities/utilities.rb
#sum ⇒ Object
Add each object of the array to each other in order to get the sum, as long as all objects respond to + operator
30 31 32 |
# File 'lib/utilities/utilities.rb', line 30 def sum empty? ? 0 : flatten.compact.inject( :+ ) end |