Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/mean/sum.rb,
lib/mean/mean.rb

Instance Method Summary collapse

Instance Method Details

#meanObject



2
3
4
# File 'lib/mean/mean.rb', line 2

def mean
  sum / size
end

#sumObject



2
3
4
# File 'lib/mean/sum.rb', line 2

def sum
  inject(nil){|sum, x| sum ? sum + x : x}
end