Class: FavLanguage::LanguageStats
- Inherits:
-
Object
- Object
- FavLanguage::LanguageStats
- Defined in:
- lib/fav_language/language_stats.rb
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(username:, token: nil, repo_list_class: RepoList) ⇒ LanguageStats
constructor
A new instance of LanguageStats.
Constructor Details
#initialize(username:, token: nil, repo_list_class: RepoList) ⇒ LanguageStats
Returns a new instance of LanguageStats.
3 4 5 6 7 |
# File 'lib/fav_language/language_stats.rb', line 3 def initialize(username:, token: nil, repo_list_class: RepoList) @username = username @token = token @repo_list_class = repo_list_class end |
Instance Method Details
#fetch ⇒ Object
9 10 11 12 13 |
# File 'lib/fav_language/language_stats.rb', line 9 def fetch language_stats.group_by(&:language).map do |language, stats| OpenStruct.new(language: language, weight: stats.inject(0){ |sum, next_one| sum + next_one.bytes }) end end |