Use .reduce(&:+) to sum elements in an array