Sha256: c0c5ccebfe1937b0f5ed702bd20375583e1daef74d5169a7bfefe9f789ab0f38
Contents?: true
Size: 685 Bytes
Versions: 2
Compression:
Stored size: 685 Bytes
Contents
require 'descriptive-statistics' # Small gem with descriptive statistics functionalities module Twstats class LogStats attr_reader :logs # This class analyzes a give set of data and is used to extract information from times logged def initialize(logs) @logs = logs end def mean_log_time map = logs.map{|l| l.decimal_time} DescriptiveStatistics::Stats.new(map).mean end def mean_task_time(tasks) time_per_task = [] tasks.each do |task| time_per_task << logs.select{|ll| ll.task == task}.inject(0){|sum, ll| sum + ll.decimal_time} end DescriptiveStatistics::Stats.new(time_per_task).mean end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twstats-0.3.0 | lib/twstats/descriptive_stats.rb |
twstats-0.2.5 | lib/twstats/descriptive_stats.rb |