Class: Gitlab::Git::Stats
- Inherits:
-
Object
- Object
- Gitlab::Git::Stats
- Defined in:
- lib/gitlab_git/stats.rb
Instance Attribute Summary collapse
-
#ref ⇒ Object
Returns the value of attribute ref.
-
#repo ⇒ Object
Returns the value of attribute repo.
Instance Method Summary collapse
- #authors ⇒ Object
- #authors_count ⇒ Object
- #commits_count ⇒ Object
- #files_count ⇒ Object
- #graph ⇒ Object
-
#initialize(repo, ref) ⇒ Stats
constructor
A new instance of Stats.
Constructor Details
#initialize(repo, ref) ⇒ Stats
Returns a new instance of Stats.
6 7 8 |
# File 'lib/gitlab_git/stats.rb', line 6 def initialize repo, ref @repo, @ref = repo, ref end |
Instance Attribute Details
#ref ⇒ Object
Returns the value of attribute ref.
4 5 6 |
# File 'lib/gitlab_git/stats.rb', line 4 def ref @ref end |
#repo ⇒ Object
Returns the value of attribute repo.
4 5 6 |
# File 'lib/gitlab_git/stats.rb', line 4 def repo @repo end |
Instance Method Details
#authors ⇒ Object
10 11 12 |
# File 'lib/gitlab_git/stats.rb', line 10 def @authors ||= end |
#authors_count ⇒ Object
23 24 25 |
# File 'lib/gitlab_git/stats.rb', line 23 def .size end |
#commits_count ⇒ Object
14 15 16 |
# File 'lib/gitlab_git/stats.rb', line 14 def commits_count @commits_count ||= repo.commit_count(ref) end |
#files_count ⇒ Object
18 19 20 21 |
# File 'lib/gitlab_git/stats.rb', line 18 def files_count args = [ref, '-r', '--name-only' ] repo.git.native(:ls_tree, {}, args).split("\n").count end |
#graph ⇒ Object
27 28 29 |
# File 'lib/gitlab_git/stats.rb', line 27 def graph @graph ||= build_graph end |