Module: JekyllRecker::Math

Included in:
Generators::Base
Defined in:
lib/jekyll_recker/math.rb

Overview

Math Module

Instance Method Summary collapse

Instance Method Details

#average(numlist) ⇒ Object



6
7
8
9
# File 'lib/jekyll_recker/math.rb', line 6

def average(numlist)
  calc = numlist.inject { |sum, el| sum + el }.to_f / numlist.size
  calc.round
end

#total(numlist) ⇒ Object



11
12
13
# File 'lib/jekyll_recker/math.rb', line 11

def total(numlist)
  numlist.inject(0) { |sum, x| sum + x }
end