Sha256: 0dc9aca3642e38a48fccf02c644d167a7637dad83820752a6d44b7f76f39745c
Contents?: true
Size: 527 Bytes
Versions: 2
Compression:
Stored size: 527 Bytes
Contents
class Calculator HALF_LIFE = 60.0*60*24 def initialize(time) @time = time end def go(stats) heat = {} stats.each do |commit| time_delta = @time - commit[:time] unless commit[:affected_files] next end commit[:affected_files].each do |file| impact = (file[:insertions] + file[:deletions]).to_f heat[file[:file]] ||= 0 heat[file[:file]] += impact*(0.5**(time_delta/HALF_LIFE)) end end heat.sort_by {|_key, value| value}.reverse end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git_heat-0.1.0 | lib/git_heat/calculator.rb |
git_heat-0.0.1 | lib/git_heat/calculator.rb |