Method: CommonLib::Array#average

Defined in:
lib/common_lib/ruby/array.rb

#averageObject

Return the average digitized value of the array



36
37
38
39
40
41
42
43
# File 'lib/common_lib/ruby/array.rb', line 36

def average
  if self.length > 0
    # sum defined in activesupport/lib/active_support/core_ext/enumerable.rb
    self.digitize.sum.to_f / self.length
  else
    nil
  end
end