Class: GitStats::GitData::Author
- Inherits:
-
Object
- Object
- GitStats::GitData::Author
- Includes:
- HashInitializable
- Defined in:
- lib/git_stats/git_data/author.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #activity ⇒ Object
- #changed_lines ⇒ Object
- #commits ⇒ Object
- #commits_sum_by_date ⇒ Object
- #deletions ⇒ Object
- #dirname ⇒ Object
- #insertions ⇒ Object
- #short_stats ⇒ Object
- #to_s ⇒ Object
Methods included from HashInitializable
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
9 10 11 |
# File 'lib/git_stats/git_data/author.rb', line 9 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/git_stats/git_data/author.rb', line 9 def name @name end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
9 10 11 |
# File 'lib/git_stats/git_data/author.rb', line 9 def repo @repo end |
Instance Method Details
#==(other) ⇒ Object
61 62 63 |
# File 'lib/git_stats/git_data/author.rb', line 61 def ==(other) [self.repo, self.name, self.email] == [other.repo, other.name, other.email] end |
#activity ⇒ Object
49 50 51 |
# File 'lib/git_stats/git_data/author.rb', line 49 def activity @activity ||= Activity.new(commits) end |
#changed_lines ⇒ Object
15 16 17 |
# File 'lib/git_stats/git_data/author.rb', line 15 def changed_lines insertions + deletions end |
#commits ⇒ Object
11 12 13 |
# File 'lib/git_stats/git_data/author.rb', line 11 def commits @commits ||= repo.commits.select { |commit| commit. == self } end |
#commits_sum_by_date ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/git_stats/git_data/author.rb', line 27 def commits_sum_by_date sum = 0 commits.map { |commit| sum += 1 [commit.date, sum] } end |
#deletions ⇒ Object
23 24 25 |
# File 'lib/git_stats/git_data/author.rb', line 23 def deletions short_stats.map(&:deletions).sum end |
#dirname ⇒ Object
53 54 55 |
# File 'lib/git_stats/git_data/author.rb', line 53 def dirname @name.underscore.split.join '_' end |
#insertions ⇒ Object
19 20 21 |
# File 'lib/git_stats/git_data/author.rb', line 19 def insertions short_stats.map(&:insertions).sum end |
#short_stats ⇒ Object
45 46 47 |
# File 'lib/git_stats/git_data/author.rb', line 45 def short_stats commits.map(&:short_stat) end |
#to_s ⇒ Object
57 58 59 |
# File 'lib/git_stats/git_data/author.rb', line 57 def to_s "#{self.class} #@name <#@email>" end |