Sha256: 9344b99a5c5b5f1b64f110436a4844300cf460db2156f78cf7a17b74c5da9c70
Contents?: true
Size: 841 Bytes
Versions: 4
Compression:
Stored size: 841 Bytes
Contents
module DeepTest module Metrics class Data def initialize @measurements_by_category = {} end def add(measurement) categories = @measurements_by_category[measurement.category] ||= [] categories << measurement end def summary summary = [] summary << "Metrics Data\n" summary << "------------\n" @measurements_by_category.keys.sort.map do |category| measurements = @measurements_by_category[category] units = measurements.first.units summary << "#{category}: #{Measurement.average(measurements)} avg / #{Measurement.total(measurements)} total #{units}\n" end summary.join end def save(file) File.open(file, "w") do |f| f << summary end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems