Class: PairingMatrix::GithubCommitReader
- Inherits:
-
CommitReader
- Object
- CommitReader
- PairingMatrix::GithubCommitReader
- Defined in:
- lib/pairing_matrix/github_commit_reader.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ GithubCommitReader
constructor
A new instance of GithubCommitReader.
- #read(since) ⇒ Object
Methods inherited from CommitReader
#authors, #authors_with_commits
Constructor Details
#initialize(config) ⇒ GithubCommitReader
Returns a new instance of GithubCommitReader.
9 10 11 12 13 |
# File 'lib/pairing_matrix/github_commit_reader.rb', line 9 def initialize(config) super(config) @github_client = github_client @cache = CommitCache.new end |
Instance Method Details
#read(since) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pairing_matrix/github_commit_reader.rb', line 15 def read(since) cache = @cache.get(since) return cache unless cache.nil? commits = [] together do @config.github_repos.map do |repo| async do commits << fetch_commits(repo, since) end end end result = commits.flatten @cache.put(since, result) result end |