Sha256: d07796851da76ac4e63c46a6549ea8b3383b46e2c791e2710a440f119da4a71c
Contents?: true
Size: 1.31 KB
Versions: 18
Compression:
Stored size: 1.31 KB
Contents
# -*- encoding : utf-8 -*- require 'git_stats/hash_initializable' module GitStats module GitData class Author include HashInitializable attr_reader :repo, :name, :email def commits @commits ||= repo.commits.select { |commit| commit.author == self } end def changed_lines insertions + deletions end def insertions short_stats.map(&:insertions).sum end def deletions short_stats.map(&:deletions).sum end def commits_sum_by_date sum = 0 commits.map { |commit| sum += 1 [commit.date, sum] } end [:insertions, :deletions, :changed_lines].each do |method| define_method "#{method}_by_date" do sum = 0 commits.map { |commit| sum += commit.short_stat.send(method) [commit.date, sum] } end end def short_stats commits.map(&:short_stat) end def activity @activity ||= Activity.new(commits) end def dirname @name.underscore.split.join '_' end def to_s "#{self.class} #@name <#@email>" end def ==(other) [self.repo, self.name, self.email] == [other.repo, other.name, other.email] end end end end
Version data entries
18 entries across 18 versions & 1 rubygems