Class: Gitlab::Git::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab_git/stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#refObject

Returns the value of attribute ref.



4
5
6
# File 'lib/gitlab_git/stats.rb', line 4

def ref
  @ref
end

#repoObject

Returns the value of attribute repo.



4
5
6
# File 'lib/gitlab_git/stats.rb', line 4

def repo
  @repo
end

Instance Method Details

#authorsObject



10
11
12
# File 'lib/gitlab_git/stats.rb', line 10

def authors
  @authors ||= collect_authors
end

#authors_countObject



23
24
25
# File 'lib/gitlab_git/stats.rb', line 23

def authors_count
  authors.size
end

#commits_countObject



14
15
16
# File 'lib/gitlab_git/stats.rb', line 14

def commits_count
  @commits_count ||= repo.commit_count(ref)
end

#files_countObject



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

#graphObject



27
28
29
# File 'lib/gitlab_git/stats.rb', line 27

def graph
  @graph ||= build_graph
end