From 7ac6dcb6c47a6715672220744ab00d8e04d92ea9 Mon Sep 17 00:00:00 2001 From: Tomasz Gieniusz Date: Sun, 21 Oct 2012 23:04:48 +0200 Subject: [PATCH] refactor --- lib/git_stats/git_data/author.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/git_stats/git_data/author.rb b/lib/git_stats/git_data/author.rb index ec1f780f9..e14ecea8b 100644 --- a/lib/git_stats/git_data/author.rb +++ b/lib/git_stats/git_data/author.rb @@ -11,6 +11,14 @@ module GitStats @commits ||= repo.commits.select { |commit| commit.author == self } 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| @@ -20,10 +28,6 @@ module GitStats end [:insertions, :deletions].each do |method| - define_method method do - short_stats.map { |s| s.send(method)} .sum - end - define_method "#{method}_by_date" do sum = 0 commits.map { |commit|