Class: FavLanguage::RepoList
- Inherits:
-
Object
- Object
- FavLanguage::RepoList
- Defined in:
- lib/fav_language/repo_list.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
readonly
Returns the value of attribute github.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(github:, username:) ⇒ RepoList
constructor
A new instance of RepoList.
- #language_stats ⇒ Object
Constructor Details
#initialize(github:, username:) ⇒ RepoList
Returns a new instance of RepoList.
7 8 9 10 |
# File 'lib/fav_language/repo_list.rb', line 7 def initialize(github:, username:) @github = github @username = username end |
Instance Attribute Details
#github ⇒ Object (readonly)
Returns the value of attribute github.
5 6 7 |
# File 'lib/fav_language/repo_list.rb', line 5 def github @github end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/fav_language/repo_list.rb', line 5 def username @username end |
Instance Method Details
#fetch ⇒ Object
12 13 14 15 16 17 |
# File 'lib/fav_language/repo_list.rb', line 12 def fetch @repos ||= github.repos .list(user: username, auto_pagination: true) .reject{ |r| r["fork"] } .map{ |r| Repo.new(r, github: github) } end |
#language_stats ⇒ Object
19 20 21 22 23 |
# File 'lib/fav_language/repo_list.rb', line 19 def language_stats fetch.flat_map do |repo| repo.language_stats end end |