Class: Reponaut::StatisticsCalculator
- Defined in:
- lib/reponaut/statistics.rb
Instance Attribute Summary collapse
-
#repos ⇒ Object
readonly
Returns the value of attribute repos.
Instance Method Summary collapse
-
#initialize(repos) ⇒ StatisticsCalculator
constructor
A new instance of StatisticsCalculator.
- #language_counts ⇒ Object
Constructor Details
#initialize(repos) ⇒ StatisticsCalculator
Returns a new instance of StatisticsCalculator.
5 6 7 |
# File 'lib/reponaut/statistics.rb', line 5 def initialize(repos) @repos = repos end |
Instance Attribute Details
#repos ⇒ Object (readonly)
Returns the value of attribute repos.
3 4 5 |
# File 'lib/reponaut/statistics.rb', line 3 def repos @repos end |
Instance Method Details
#language_counts ⇒ Object
9 10 11 12 13 |
# File 'lib/reponaut/statistics.rb', line 9 def language_counts langs = Hash.new { |hash, key| hash[key] = 0 } repos.group_by { |r| r.language }.map { |e| langs[e[0]] = e[1].count } langs end |