Class: CommitCommentTools::RepositoryStats::CommitGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/commit-comment-tools/repository-stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(branch_name, key, commits) ⇒ CommitGroup

Returns a new instance of CommitGroup.



31
32
33
34
35
# File 'lib/commit-comment-tools/repository-stats.rb', line 31

def initialize(branch_name, key, commits)
  @branch_name = branch_name
  @key = key
  @commits = commits
end

Instance Attribute Details

#branch_nameObject (readonly)

Returns the value of attribute branch_name.



29
30
31
# File 'lib/commit-comment-tools/repository-stats.rb', line 29

def branch_name
  @branch_name
end

#commitsObject (readonly)

Returns the value of attribute commits.



29
30
31
# File 'lib/commit-comment-tools/repository-stats.rb', line 29

def commits
  @commits
end

#keyObject (readonly)

Returns the value of attribute key.



29
30
31
# File 'lib/commit-comment-tools/repository-stats.rb', line 29

def key
  @key
end

Instance Method Details

#diff_bytesizeObject



47
48
49
50
51
# File 'lib/commit-comment-tools/repository-stats.rb', line 47

def diff_bytesize
  @diff_bytesize ||= commits.inject(0) do |memo, commit|
    memo + commit.diff_bytesize
  end
end

#diff_lines_countObject



41
42
43
44
45
# File 'lib/commit-comment-tools/repository-stats.rb', line 41

def diff_lines_count
  @diff_lines_count ||= commits.inject(0) do |memo, commit|
    memo + commit.diff_lines_count
  end
end

#sizeObject



37
38
39
# File 'lib/commit-comment-tools/repository-stats.rb', line 37

def size
  @commits.size
end