mirror of
https://github.com/tomgi/git_stats.git
synced 2024-11-17 17:15:22 +01:00
dry
This commit is contained in:
parent
35d03d9392
commit
99921c44ea
1 changed files with 9 additions and 17 deletions
|
@ -48,24 +48,16 @@ module GitStats
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def lines_added_by_author
|
[:lines_added_by_author, :lines_deleted_by_author].each do |method|
|
||||||
|
define_method method do
|
||||||
Chart.new do |f|
|
Chart.new do |f|
|
||||||
f.column_hash_chart(
|
f.column_hash_chart(
|
||||||
data: Hash[@repo.lines_added_by_author.map {|a, l| [a.email, l]}],
|
data: Hash[@repo.send(method).map { |a, l| [a.email, l] }],
|
||||||
title: :lines_added_by_author.t,
|
title: method.t,
|
||||||
y_text: :lines.t
|
y_text: :lines.t
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def lines_deleted_by_author
|
|
||||||
Chart.new do |f|
|
|
||||||
f.column_hash_chart(
|
|
||||||
data: Hash[@repo.lines_deleted_by_author.map {|a, l| [a.email, l]}],
|
|
||||||
title: :lines_deleted_by_author.t,
|
|
||||||
y_text: :lines.t
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue