Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_qa/array.rb

Instance Method Summary collapse

Instance Method Details

#aaq_avgObject



12
13
14
# File 'lib/acts_as_qa/array.rb', line 12

def aaq_avg
  self.aaq_sum/self.length
end

#aaq_percentageObject



7
8
9
10
# File 'lib/acts_as_qa/array.rb', line 7

def aaq_percentage
  return 100 if self.aaq_sum.nil?
  self.aaq_sum*100/self.length
end

#aaq_sumObject



3
4
5
# File 'lib/acts_as_qa/array.rb', line 3

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