Sha256: 4a70b38ec8907fd4a50f61c4f11d24ac446e99415ff3e68f26e5177042abf608
Contents?: true
Size: 1.12 KB
Versions: 7
Compression:
Stored size: 1.12 KB
Contents
# -*- encoding : utf-8 -*- module GitStats module StatsView module Charts class AuthorsCharts def initialize(authors) @authors = authors end def commits_sum_by_author_by_date(limit = 4, authors = nil) Chart.new do |f| f.multi_date_chart( data: (authors || @authors.sort_by { |author| -author.commits.size }[0..limit]).map { |author| {name: author.name, data: author.commits_sum_by_date} }, title: :lines_by_date.t, y_text: :lines.t ) end end [:insertions, :deletions, :changed_lines].each do |method| define_method "#{method}_by_author_by_date" do |limit = 4, authors = nil| Chart.new do |f| f.multi_date_chart( data: (authors || @authors.sort_by { |author| -author.send(method) }[0..limit]).map { |author| {name: author.name, data: author.send("#{method}_by_date")} }, title: :lines_by_date.t, y_text: :lines.t ) end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems