Class: We::GitHubStats::Repository
- Inherits:
-
Object
- Object
- We::GitHubStats::Repository
- Defined in:
- lib/we/github_stats/repository.rb
Defined Under Namespace
Classes: InProgressError
Instance Attribute Summary collapse
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(client:, name:, full_name:) ⇒ Repository
constructor
A new instance of Repository.
- #num_commits ⇒ Object
- #num_lines_added ⇒ Object
- #num_lines_removed ⇒ Object
Constructor Details
#initialize(client:, name:, full_name:) ⇒ Repository
Returns a new instance of Repository.
6 7 8 9 10 |
# File 'lib/we/github_stats/repository.rb', line 6 def initialize(client:, name:, full_name:) @client = client @full_name = full_name @name = name end |
Instance Attribute Details
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
12 13 14 |
# File 'lib/we/github_stats/repository.rb', line 12 def full_name @full_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/we/github_stats/repository.rb', line 12 def name @name end |
Instance Method Details
#num_commits ⇒ Object
14 15 16 |
# File 'lib/we/github_stats/repository.rb', line 14 def num_commits fetch_commit_activity && fetch_commit_activity.map(&:total).inject(:+) end |
#num_lines_added ⇒ Object
18 19 20 |
# File 'lib/we/github_stats/repository.rb', line 18 def num_lines_added fetch_code_frequency && fetch_code_frequency.map { |week| week[1] }.inject(:+) end |
#num_lines_removed ⇒ Object
22 23 24 |
# File 'lib/we/github_stats/repository.rb', line 22 def num_lines_removed fetch_code_frequency && fetch_code_frequency.map { |week| week[2] }.inject(:+) end |