Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/bigbench/post_processor/environment.rb
Overview
Adding the sum and average methods to the default array
Instance Method Summary collapse
Instance Method Details
#average ⇒ Object
22 23 24 25 |
# File 'lib/bigbench/post_processor/environment.rb', line 22 def average result = sum / size.to_f result.nan? ? 0 : result end |
#sum ⇒ Object
18 19 20 |
# File 'lib/bigbench/post_processor/environment.rb', line 18 def sum reduce(:+).to_f end |