lib/zold/stress/stats.rb in zold-stress-0.2.0 vs lib/zold/stress/stats.rb in zold-stress-0.3.0
- old
+ new
@@ -49,11 +49,10 @@
def avg(metric)
sum(metric).to_f / [total(metric), 1].max
end
def sum(metric)
- array = @history[metric].map { |a| a[:value] } || []
- array.inject(&:+) || 0
+ (@history[metric] || []).map { |a| a[:value] }.inject(&:+) || 0
end
def to_json
@history.map do |m, h|
data = h.map { |a| a[:value] }