Class: GitStats::StatsView::Charts::AuthorsCharts
- Inherits:
-
Object
- Object
- GitStats::StatsView::Charts::AuthorsCharts
- Defined in:
- lib/git_stats/stats_view/charts/authors_charts.rb
Constant Summary collapse
- AUTHORS_ON_CHART_LIMIT =
4
Instance Method Summary collapse
- #commits_sum_by_author_by_date(authors = nil) ⇒ Object
-
#initialize(authors) ⇒ AuthorsCharts
constructor
A new instance of AuthorsCharts.
Constructor Details
#initialize(authors) ⇒ AuthorsCharts
Returns a new instance of AuthorsCharts.
8 9 10 |
# File 'lib/git_stats/stats_view/charts/authors_charts.rb', line 8 def initialize() @authors = end |
Instance Method Details
#commits_sum_by_author_by_date(authors = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/git_stats/stats_view/charts/authors_charts.rb', line 12 def ( = nil) Chart.new do |f| f.multi_date_chart( data: ( || @authors.sort_by { || -.commits.size }[0..AUTHORS_ON_CHART_LIMIT]).map { || {name: .name, data: .commits_sum_by_date} }, title: :lines_by_date.t, y_text: :lines.t ) end end |