class LastWeeksCommitStats

Public Class Methods

new() click to toggle source
# File lib/gitstats/stats/commit/time.rb, line 92
def initialize
  today = Time.now.to_date
  nextCwStart = Date.commercial(today.cwyear,today.cweek)+7
  @hash = Hash.new
  @base = nextCwStart.to_time
end

Public Instance Methods

update(commit) click to toggle source
# File lib/gitstats/stats/commit/time.rb, line 99
def update(commit)
  return if commit[:time] > @base

  diff = ((@base - commit[:time]) / 604800).to_i
  return if diff >= 52

  @hash[diff] ||= CommitStats.new
  @hash[diff].update(commit)
end